Javascript Alerts to Display Console Errors & Messages

Allure Web Solutions Code Snippet

Sometimes you don’t have access to a JavaScript console and need to display console errors some other way. This could be a common case for ┬ámobile development. With the below snippet, console errors will appear within alerts real time.

if (typeof console  != "undefined") 
    if (typeof console.log != 'undefined')
        console.olog = console.log;
        console.olog = function() {};

console.log = function(message) {
' + message + '
console.error = console.debug = = console.log

// Credit:


Mike Doubintchik

Author Mike Doubintchik

More posts by Mike Doubintchik

Leave a Reply