Arch
Arch

Reputation: 1419

window.onerror getting an empty url?

What would cause window.onerror to receive an empty url parameter? A client is getting JS errors every 16 seconds and my logs show the error has no url. Is this likely from a plugin? Is it safe to ignore errors from window.onerror that have an empty URL?

This is happening in safari for the record, and I don't have access to the computer

webkit: true
version: 537.36
safari: true
Netscape 5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.76 Safari/537.36

Upvotes: 1

Views: 1234

Answers (1)

Arch
Arch

Reputation: 1419

I think I have figured it out using this fiddle I made: http://jsfiddle.net/Mza9X/

It seems that errors occurring in setTimeout cause an empty URL in window.onerror The second link, when clicked It might also be the case for setInterval

<a href="#" onclick="gsegsge.segseg">Click me</a>
<br />
<a href="#" onclick="setTimeout('segse.segseg', 1000);">Click me2</a>

<script>
    window.onerror = function(one, two, three) {
    alert(two);
    alert(arguments[1]);
    }
</script>

Where it's actually coming from in my case is still unknown since there should be nothing that is supposed to act like this... :P

Upvotes: 2

Related Questions