...

View Full Version : Enable script errors in IE



Basscyst
10-31-2004, 10:01 PM
My work seems to have locked me out of the advanced tab in IE, so I can't enable script errors. Every now and again it will still prompt me with an error and I can click the checkbox to always provide notification. I can't for the life of me though, figure out what I am doing for it to throw the error, it seems random. If anyone knows or if they know of another way to enable the error reporting it'd be swell.

Basscyst

liorean
10-31-2004, 10:20 PM
Well, there are a number of practical things. If it's an iew specific error, your best shot is probably to use the Microsoft Script Debugger (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sdbug/Html/sdbug_1.asp).

Another solution that only works for cross browser errors is to use the excellent debuging facilities of moz. JavaScript Console, enabling strict warnings, using Venkman (the JavaScript Debugger), the DOM inspector and the error tracing features in the native objects provide the best platform for bug tracking you can find.

Op7, if you enable displaying errors in the JavaScript Console, is excellent for tracing errors related to events and event handling, though it in other areas is not quite as good as the moz JavaScript Console. Op7 has the benefit of being closer to iew than moz is, when it comes to host environment.

Then there are the source code tricks you can use. The most efficient is to insert try..catch statements in the code, and alerting/prompting values for inspection to follow the runtime environment. There are of course cruder things you can use as well.

(Hmm, I kinda recall posting about JavaScript debugging this in the FAQ some time back, maybe you should check there.)

Philip M
11-01-2004, 07:50 AM
"There are of course cruder things you can use as well."

More details, please!

liorean
11-01-2004, 06:11 PM
Well, how about using the address bar for inserting 'javascript:' pseudo URIs for inspecting the runtime, using the window.onerror event, or just filling your script with alerts, confirms and prompts? Neither is as useful as the detect-and-handle approach of try..catch and well placed inspection if-statements for the non-error bug detection. Onerrror doesn't allow locally specific handling in the way try..catch do. etc.

I listed the tricks I think are most useful.

Basscyst
11-01-2004, 11:50 PM
Indeed, I see where you are coming from, and appreciate the advice but I can't install any additional software. With all due respect I wasn't asking about the best ways to debug a script or alternativesto IE, I was asking what I can due in my code to throw the error in IE even if the script errors are off, so that I can turn it back on by clicking the always display the errors checkbox. Somtimes if I just throw in a random quote mark or somthing it will pop up anyhow. If noone knows that's cool. I can muddle through.

Basscyst

Roy Sinclair
11-02-2004, 03:51 PM
Noting your inability to alter the working environment, as Liorean pointed out the most efficient way to catch errors is using the try { ... normal code here ...} catch (errorInformation) {... error handling code here...} construct. If you wrap an entire function in a try block then any errors in that function will be passed to the catch block. The variable "errorInformation" is the error object and you can display the error using an alert.



function flaky()
{
try
{
// Some code that may generate errors
}
catch (theError)
{
alert(theError.message)
}
}

Basscyst
11-04-2004, 07:47 PM
Thanks Roy, I see how it works. That helps a bit, I usually use an alert to narrow down the area the error is occuring. At least now I can see why the error is occuring. Still more time consuming then just having it tell me what line the error is on (or around at least, IE error reporting does still suck). I really just needed the example, I understand now.

Thanks,
Basscyst

kansel
11-04-2004, 09:49 PM
Of course there's the obvious. If the script you are working on is for work, you should inform your supervisor or IT dept. that the "standard practices" are keeping you from efficiently completing your job. Given the highly technical aspect of your job, they should at least consider turning on IE's script error dialog for your installation so that you can continue writing quality scripts.

Roy Sinclair
11-04-2004, 10:15 PM
Of course there's the obvious. If the script you are working on is for work, you should inform your supervisor or IT dept. that the "standard practices" are keeping you from efficiently completing your job. Given the highly technical aspect of your job, they should at least consider turning on IE's script error dialog for your installation so that you can continue writing quality scripts.

If they're half as head-blind as the people in charge of security where I work he's got next to no chance of making that happen. One size never fits all but you can't convince some people of that.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum