Reputation: 26048
There are 2 scripts on the page. If the first one causes an error, then the second refuse to work because of this.
How do I make the second script turn a blind eye to the first one's errors and work anyway? Keep in mind that I'm not allowed to change the first script.
Upvotes: 1
Views: 453
Reputation:
Maybe this might help
<script type="text/javascript">
function stoperror()
{
return true;
}
window.onerror=stoperror();
</script>
MOZILLA DEVELOPER NETWORK window.onerror
Upvotes: 4
Reputation: 584
I would use try and catch blocks, and disregard any error.
That should work..
Example
try
{
//Run some code here
}
catch(err)
{
//Handle errors here
}
Upvotes: 2
Reputation: 7100
Javascript execution stops when the error occurs...
You can not change this behavior...
To get around, put the code that causes an error inside try
block
try{
//code that might produce some error
} catch(e){
}
Upvotes: 2