diff --git a/src/templates/pad.html b/src/templates/pad.html index 2d4ceca0b..3597ff7b3 100644 --- a/src/templates/pad.html +++ b/src/templates/pad.html @@ -320,12 +320,17 @@ /* Display errors on page load to the user (Gets overridden by padutils.setupGlobalExceptionHandler) */ - window.onerror = function(msg, url, line) { - var box = document.getElementById('editorloadingbox'); - box.innerHTML = '

An error occured while loading the pad

' - + '

'+msg+' ' - + 'in '+ url +' (line '+ line +')

' - }; + (function() { + var originalHandler = window.onerror; + window.onerror = function(msg, url, line) { + var box = document.getElementById('editorloadingbox'); + box.innerHTML = '

An error occured while loading the pad

' + + '

'+msg+' ' + + 'in '+ url +' (line '+ line +')

'; + // call original error handler + if(typeof(originalHandler) == 'function') originalHandler.call(null, arguments); + }; + })();