Note that there are some explanatory texts on larger screens.

plurals
  1. POCryptic "Script Error." reported in Javascript in Chrome and Firefox
    primarykey
    data
    text
    <p>I have a script that detects Javascript errors on my website and sends them to my backend for reporting. It reports the first error encountered, the supposed line number, and the time.</p> <p><strong>EDIT to include doctype:</strong></p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" xmlns:fb="http://www.facebook.com/2008/fbml"&gt; </code></pre> <p><strong>...</strong></p> <pre><code>&lt;script type="text/javascript"&gt; //&lt;![CDATA[ // for debugging javascript! (function(window){ window.onerror = function(msg, url, ln) { //transform errors if (typeof(msg) === 'object' &amp;&amp; msg.srcElement &amp;&amp; msg.target) { if(msg.srcElement == '[object HTMLScriptElement]' &amp;&amp; msg.target == '[object HTMLScriptElement]'){ msg = 'Error loading script'; }else{ msg = 'Event Error - target:' + msg.target + ' srcElement:' + msg.srcElement; } } msg = msg.toString(); //ignore errors if(msg.indexOf("Location.toString") &gt; -1){ return; } if(msg.indexOf("Error loading script") &gt; -1){ return; } //report errors window.onerror = function(){}; (new Image()).src = "/jserror.php?msg=" + encodeURIComponent(msg) + "&amp;url=" + encodeURIComponent(url || document.location.toString().replace(/#.*$/, "")) + "&amp;ln=" + parseInt(ln || 0) + "&amp;r=" + (+new Date()); }; })(window); //]]&gt; &lt;/script&gt; </code></pre> <p>Because of this script, I'm acutely aware of any javascript errors that are happening on my site. <strong>One of by biggest offenders is "Script Error." on line 0.</strong> in Chrome 10+, and Firefox 3+. This error doesn't exist (or may be called something else?) in Internet Explorer.</p> <p><strong>Correction (5/23/2013):</strong> This "Script Error, Line 0" error is now showing up in IE7 and possibly other versions of IE. Possibly a result of a recent IE security patch as this behavior previously did not exist.</p> <p>Does anyone have any idea what this error means or what causes it? It happens on about 0.25% of my overall pageloads, and represents half the reported errors.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload