"Asegurar su presencia en Internet contribuye"

Javascript errors, line numbers from IE

Imagen de admin
Posted by admin on Mar 02 Jun 2009

Recently I received an email from Gary who tried out my shareware Javscript editor, ScrypTik. I tried to reply directly, but his email bounced. Gary's question was a good one, so I'll answer it here as it may help others. Question:

I have downloaded a copy of ScrypTik and I like what it can offer. However, I have the following issue which is typical of my application:

I have a PHP file which refers to numerous js files e.g. When running the PHP, The IE browser (v7) will refer to a line number "line 706: character 3" which bears no relation to my PHP source file. It seems to be erroring on some Javascript at run-time. I know this is a run-time error since it occurs in specific situations.

What is the best way of locating the error with your product?

My Answer:

Thanks for your interest in ScrypTik. The easiest way to locate this error is to "view source" in your browser. Then copy this plain text into an editior that shows line numbers (such as ScrypTik), then you can see what is on line 706. Firefox with the HTML tidy plugin does this with view source. Also the Firefox error console will give you a display of the line of code that is giving the error. When developing, I always use Firefox. The firebug plugin is fantastic for AJAX debugging and css issues.

So the answer is that ScrypTik can't really unravel IE error reporting because it does not always know where the Javascript will end up.

Basically, avoid using IE except for testing how your pages look. This should be done every hour so if (when!) something breaks, you have a good idea of what caused it.


Añadir nuevo comentario