diff --git a/src/static/js/pad_utils.js b/src/static/js/pad_utils.js index 4f958a6ca..d200420e6 100644 --- a/src/static/js/pad_utils.js +++ b/src/static/js/pad_utils.js @@ -484,7 +484,6 @@ function setupGlobalExceptionHandler() { globalExceptionHandler = function test (msg, url, linenumber) { var errorId = randomString(20); - var userAgent = padutils.escapeHtml(navigator.userAgent); var msgAlreadyVisible = false; $('.gritter-item .error-msg').each(function() { @@ -494,13 +493,19 @@ function setupGlobalExceptionHandler() { }); if (!msgAlreadyVisible) { - errorMsg = "Please press and hold Ctrl and press F5 to reload this page
\ - If the problem persists please send this error message to your webmaster:

\ -
\ - ErrorId: " + errorId + "
\ - URL: " + padutils.escapeHtml(window.location.href) + "
\ - UserAgent: " + userAgent + "
\ - "+ msg + " in " + url + " at line " + linenumber + '
'; + const txt = document.createTextNode.bind(document); // Convenience shorthand. + const errorMsg = [ + $('

') + .append($('').text('Please press and hold Ctrl and press F5 to reload this page')), + $('

') + .text('If the problem persists, please send this error message to your webmaster:'), + $('

').css('text-align', 'left').css('font-size', '.8em').css('margin-top', '1em') + .append(txt(`ErrorId: ${errorId}`)).append($('
')) + .append(txt(`URL: ${window.location.href}`)).append($('
')) + .append(txt(`UserAgent: ${navigator.userAgent}`)).append($('
')) + .append($('').addClass('error-msg').text(msg)).append($('
')) + .append(txt(`at ${url} at line ${linenumber}`)).append($('
')), + ]; $.gritter.add({ title: "An error occurred",