www.webdeveloper.com
Results 1 to 3 of 3

Thread: Console Log events

  1. #1
    Join Date
    Aug 2008
    Location
    NYC
    Posts
    76

    Console Log events

    Hello,

    I was wondering is there a way to add a listener to the console? For example lets say that I rewrote the console.

    Code:
    console = {};
    console.log = function() {
    alert('console');
    };
    So now every time I have
    Code:
    console.log();
    in my code it will open the alert popup and say "console". However when you open DevTools, FireBug or whatever Browser you are using and open the console. Then type in "Hello" you see "Hello" appear in the log. Is there anyway to have events bound to the actual browser console. Since when you are typing in the browser's console is calling console.log.

    I hope that makes sense?

    Thanks!

  2. #2
    Join Date
    Jan 2005
    Posts
    369
    This sounds pretty dangerous, but if you want to do it, then give it a try.

    I suspect that it may vary between browsers - you are trying to mess with what is probably native code, so I doubt that it will work.

  3. #3
    Join Date
    Jul 2014
    Posts
    6
    You should try again to make it better.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles