View Full Version : How to stop Internet Explorer script error messages?

01-01-2012, 06:50 PM

I'm using HTA with iframes contains external web pages, lot of pages (external - not mine) contains errors and while running 'script error' pops.
If running the same pages in IE there are only error notice in the bottom left side of the browser.

Can I do something to ignore those script error popups in my HTA?
(I'm using also Javascript for my HTA)

Could I use javascript code to stop Internet Explorer script error messages?



Old Pedant
01-02-2012, 02:26 AM
Try this:

Bring up MSIE.

Click on the VIEW menu (or TOOLS icon if using MSIE 9)

Click on INTERNET OPTIONS menu item.

Click on ADVANCED tab.

CHECK "disable script debugging (internet explorer)"

UNCHECK "display a notification about every script error".

Not sure that will do it, but try it.

01-02-2012, 02:28 AM

I am looking for a programmatically solution. It is possbiel? I do not found any script about that on the Web.

Regarding the IE I have disabled this option, but the error message continues.

Old Pedant
01-02-2012, 02:45 AM
You can modify your JS code to ignore errors, but you have to do it one function at a time, in general.

You could code a function something like this:

function name( any, arguments )
try {
... normal content of the function ...
} catch ( ignored ) {
/* do nothing when there is an error */

Not that an outer function with the try ...catch will cause an error in an inner function to be ignored, so you may not need this technique on all functions.

01-02-2012, 03:59 AM
I am looking for a programmatically solution. It is possbiel? I do not found any script about that on the Web.

I would say there is no practical, programmatic solution for handling JS errors in an external web page (loaded in your iframe).

The best you could do is to use cURL (http://en.wikipedia.org/wiki/CURL) with a server side language to get the source code of the external page(s), use some regular expressions to insert some try/catch blocks, and then insert the resulting markup into a pseudo-iframe on your site. But that's an awful lot of trouble to go to correct errors in someone else's code. And what if the external site changes its code and/or updates its content? Your regular expressions may stop working.

Your best bet is to try to manually shut off the errors in IE, if you can. You could try disabling JS altogether, but then you can't use JS in your HTA. Perhaps you can find something similar to NoScript (http://noscript.net/features) for IE that you could use to selectively turn off JS for embedded frames.

Old Pedant
01-02-2012, 04:16 AM
Whoops...I missed that he said "lots of pages (not mine)". I thought he was talking about all his own code when he said he was using HTA. Teach me not to read more closely.