Currently working on liferay site and stuck with IE8 browser issue. When I loading the page I am getting the Javascript errors.
'undefined' is null or not an object dojo.xd.js line 14 character 31332
When I load the same page in Chrome and Firefox and I didn't see any java script errors.
For IE I could not able to proceed much as it is taking to dojo source file and could not able to figure it. I also tried to remove dojo components one after another to see the whether I can isolate the issue. But it doesn't help and getting the same error. Is there any better way to debug this issue/ any other tools that will help on get more information/ suggestions?
Is there any data transmission between browser and server. If so, paste here or check for correct JSON format. Extra commas, braces are usually the culprit.
Firefox and Chrome are relaxing browser and adjust themselves.
Related
I'm a beginner web developer. I often use Firebug to debug my JavaScript.
Problem is that there are some script files from my page's UI that have a lot of code and this causes my web browser to be unresponsive, i.e. I get a dialog saying the script is unresponsive. Basically this happens when I am within Firebug's Script panel.
How can I deal with this?
I tried finding solution to this problem and nothing.
As for the answer I think the best was posted by #Pablo(can't assign answer to comment unfortunately) and it is simply trying out Google Chrome console. None of the problems I mentioned exists here.
Cheers guys!
I have had the same problem debugging some of our older scripts that make extensive use of the eval() function.
This causes many scripts to be displayed within the Script Location Menu. (Each dynamically generated script is represented there.)
A possible solution, given that it was caused by the number of files in my instance, might be to see if you can bypass the problem entirely by utilizing fewer source files for the same code. Using a 'built' version of whatever frameworks you use might alleviate the problem. (Particularly if they still are debug-able in a built form.)
If that does not work, you might try debugging using Firefox' built-in debugger (available via Ctrl+Shift+S. (Or switch to another browser to do the debugging, but that is obviously a far less desirable solution.)
This is the page I'm working on... http://schnell.dreamhosters.com/folio/earthquake.html
Its purpose is explained via the instructions on the left. I'm finding that after doing so many searches and clicking so many of the links in the list on the right that the page freezes up, the Google Map stops working and Firebug tells me of an error in main.js and it goes like this...
b is undefined
Line 49
I really don't know why this decided to happen all of a sudden and the error is so cryptic and muddled amongst Google's code that I don't think I'll be able to figure this one out by myself.
Another problem I'm finding is that the page itself simply refuses to work in IE7 and IE8 (or probably any version of IE for that matter). I am also at a loss as to how to solve this problem because I can't figure out how to use any of IE's debuggers (if they even have one) and seeing how I already tested this and made it work in two browsers (technically three since Safari runs off WebKit just like Chrome), I just don't have the drive or capacity to imagine what could be going wrong.
Any help would be greatly appreciated
Moved from comment to answer.
As scunliffe mentioned, you are trying to do a crossbrowser AJAX without using jsonp. Use either $.ajax() with datatype jsonp or add a &callback=? at the end of the URL in the $.getJSON() call.
IE8 is quite good when it comes to helping out the developer. From memory F12 will open up the developer window where you can inspect the DOM, CSS and debug script.
Your error is cryptic because most javascript comes minified, so variables are all remapped to single letters, etc. See if the script causing the problem has a development (i.e. unminified) version as this will make a lot more sense to step through.
With regards to your specific issue it sounds like a timing issue. While browsers do a decent job of executing script in a consistent way if you follow standards, they do differ in their timings i.e. when things execute. That would explain why b is undefined in some cases and not others.
I have a jsp with lots of javascript code. Whenever there is a javascript error on the page, shown in the status bar of the IE browser, the line number reported to contain the error, does not match with the line number that actually contains the error.
I am doing a right click>view source to find the line number reported. But that line does not contain the error. The error, I assume, is in some other line.
What could be the reason for the erroneous line numbers being reported.
As noted in other answers, IE is bad at reporting line numbers for errors. However, the built-in debugger (press F12) in IE8 and later is much more helpful, so I suggest you try that.
I found the problem after a lot of trials. Hopefully, this will be of use to some guys facing this frustrating problem.
RightClick>View Source is the code what the browser sees to render the page. However, that is not all. The page could also have other HTTP requests to css ans js files. That was what was happening in my case. The error was in an imported(NOT INCLUDED ; had it been included the error would have been on the code) js file. And the line number reported was relative to that js file .
In retrospect ,however, i find this to be correct, since the imported files are stored separately in the browser cache, as they are independent HTTP requests to the web server. And hence should not appear in the RightClick>View Source code.
POTENTIAL PROBLEM:
However, though in my case the line number in the individual js file,reported, was found to be correct, that may not always be true.
In most enterprise applications, js and css es are often minified to reduce the byte footprint. Hence the js file that you may be looking at , in your IDE, will not be the same as the browser sees. Hence the line numbers could then be different. The line numbers will be w.r.t the compressed version of the file that the browser sees.
IE JAVASCRIPT DEBUGGING:
I found this page , which promises to offer debugger environment(albeit ,not sophisticated) in the IE environment.
http://jonathanboutelle.com/2006/01/16/how-to-debug-javascript-in-internet-explorer/
I didnt try it, as I dont have the complete Office package installed.
Internet Explorer is awful at reporting Javascript line numbers - usually the line number reported is where the Javascript <script> tag started in the HTML file, instead of the location line number in the Javascript file. Only rely on the 'Error Reported', the Line number isn't worth anything with IE.
Use another browser, for example Firefox with the Firebug Extension installed, or Google Chrome which has it's built in Web Inspector which is also great.
Here is a nice article
Debugging JavaScript: Understanding JavaScript Error Messages
The line number, in particular, turns
out to be a lot less helpful than you
might expect. Browsers differ in their
determination of the line number and
thus do not reliably report the
correct line number that an error
occurred at in relation to the source
code. Internet Explorer, for instance,
reports the line number in relation to
the browser's own internal rendering
of the document source, which may or
may not match the source file! Firefox
reports the location of the error more
reliably, reporting the script file
that an error occurred in where
applicable. Firefox will not however
provide you with details about the
element that caused the error, known
as the "caller". This information,
which can be useful in quickly tracing
the cause of an error, is currently
only provided by Internet Explorer.
If you want to get exact reason and location of error and if you want to perform extensive javascript debugging I would recommend you using FireBug.
I've recently been made aware that my site is crashing in IE7. I tested it on a bunch of machines myself, but of course it always runs perfectly.
My brother just showed me IE7 on his computer, and it definitely crashes.
I've got 'debugbar' running, and it shows some errors in the HTMLCheck, and is warning that fb:login-button is not recognized (but of course it is allowed).
I run javascript check and it says
Script Error:
//----------------
Line: 1
Character: 6
Code: 0
Error Message: Syntax error
I can't actually see any script error myself.
The link is http://HearWhere.com
If somebody could help me figure out why this is failing on 15% or so of IE users, I'd be very very greatful.
Pete
Definitely does crash IE7 on a virtual machine I have. It's worth doing a bit of an audit for a start - for example, you're including and calling the Google Analytics JS twice, which is probably screwing up your stats if nothing else.
I've had crashes related to jQuery in IE7 before, all of which I could put down to large jQuery loops. Have a look through your code and comment parts where you are looping over the results of a jQuery select that could have a large number of results, or times when you are inserting a large number of elements into the DOM.
There's no Javascript errors (according to FireBug), but a large number of errors in the CSS for that page, any one of which could be antagonising IE7.
IE8 has a really nice javascript debugger, but it doesn't crash in IE8 for me. Previously I used Microsoft Script Editor for debuggin in IE 6 & 7. For some strange reason it's bundled with Microsoft Office! It's a bit hassle to setup, but it works.
http://www.jonathanboutelle.com/mt/archives/2006/01/howto_debug_jav.html
If you are crashing, the JS code is not a likely cause. You need to look at isolating the specific OS, IE version number, patch level, and external dependencies (versions of flash, etc).
I'm getting "Object Expected JS error in IE 6 and 7. I'm not able to reproduce this always. The behavior is inconsistent. I'm using Dojo Charts in my JSP page. When this error occurs none of the Charts gets loaded.
I had a similar problem with IE before. That was a JS function was called before the JS file was loaded completely. We can see the JS file in the request, but that file is empty.
I wonder why IE is not taking the JS files from cache. It works perfectly in Mozilla.
Can some one suggest a better way to track such inconsistent JS errors?
thanks
You're dereferencing a variable which is undefined, but without an example, hard to say much beyond that.
(everything is an object in javascript so it's pretty much the only way to generate that error)
In Internet options in Advanced tab you can enable debugging.
IE has a lot of quirks that won't arise in other browsers. The best way to debug IE is to get a copy of Microsoft's Script Debugger, and you can launch it from IE to get a clearer idea of where the actual problem is. Script Debugger will halt execution at the problem line and show it in a separate window (IE locks up until you close Script Debugger, but you get a much better idea of what line is causing the problem).
See here for more: http://www.codestore.net/store.nsf/unid/DOMT-5UBUVW?OpenDocument
There's a link in the middle of that document that goes to MS Script Debugger, but here it is anyway.