AlfieWebDevTips Homefor new and experienced developers
[Home Home] [Web Development Web Development ] [Code Generators Code Generators ] [Resources Resources ] [Contact Us Contact ] |WebDevTips Privacy Privacy |
Print This Page

You are here : Home - Resources - FAQ - Javascript Q6

FAQ - Javascript Q6



Q6:An external ad script is causing an error on my page is this fixable?

A:The answer is yes and no. No, you won't probably be able to fix their sloppy code. Yes, get rid of the ads :). Just kidding there are lots of uses for using external sources but unfortunately they can be badly scripted.

First of all make sure that its not your scripts that are broken. If you are sure that the error is outwith your control then there is a solution.

The following snippet of code should be the very last thing you add. NEVER write scripts with this in place - you will never know if your scripts is causing problems.

Place this in the head of your document

    <script language="JavaScript" type="text/javascript"> 
    <!-- 
    window.onerror=oops 
    function oops(){ 
    return true; 
    } 
    // --> 
    </script>

If you have error notification disabled then you aren't testing your scripts properly are you :) tut tut - just because you can't see the error dialog doesn't mean that others can't. So there, some more free advice:)

Let's have a quick example - assuming you have error notification enabled, clicking this link should display the error dialog. If not, enable script error notification before you click on the solution here.

Now try the first click again - no error dialog. Remember do not use this when writing and testing your own scripts.


back to faq




Google
 

[back to top of page]   

[labelled with icra -  - this link will open in a new window] [RSS Content]

[Copyright © WebDevTips]