javascript not working with IE - javascript

My page is working fine with FF , but not working under IE ,
I have a JSP page and a JS file (The error is inside JS File)
I am using IE developer toolbar
Its only showung me the Line number and the character.
Please see the screen shot .
http://www.tiikoni.com/tis/view/?id=3bc4916
MY JSP file is of only 20 lines and JS file is of 200 lines , with many 3rd party JS files included.
How can we debug as i dont have that line number in my JSP FIle and view source doesn't help.
Please help me

Internet Explorer 8 has a built in debugger. You can find instructions for how to use it here JScript Debugger in IE8.
Basically, if you enable this, then you can actually go look at the code and see where the problem is.
The debugger can not only show you the code, but also a snapshot of the variables at the time the error occurs. Using this information, you can further pinpoint the problem.

Related

Chrome Debugger source file line numbers wrong

This has been driving me crazy. It just started a few weeks ago. I never had the problem before.
I'm trying to debug a simple issue in the Chrome debugger.
My cshtml source file has a script tag embedded in it with a small script. I used the tag to make Chrome recognize the "source" file:
//# sourceURL=CustomerView.js
I am able set breakpoints and they show the correct line number in the debugger. But they never hit. I add a Debugger line in the script and the chrome debugger breaks but the line number in the call stack is WAY off. There's no way for me to view/walk through the source to debug.
Any insight into this would be very helpful.

What does JScript object expected mean?

I'm using instafeedjs to display Instagram images on my website, it works in modern browsers but Internet Explorer 8 I see a Javascript error. It says
JScript object expected
instafeed.min.js Line 2
Code 0 Char:3392
URI (outputs the correct absolute link to the script)
I've put the instafeed.min.js script right at the bottom of the page in the source and it's placed after jquery-1.11.1.min.js both paths to the scripts are correct.
I don't understand the error message, can anyone explain it?

Debugging in-page javascript with Chrome when the html is minified?

The scripts on our website are embedded in the html and everything is minified. Throwing a debugger statement into the javascript to debug doesn't help very much because there's only actually one line of html in the original source. When the source is prettified with Chrome's code prettifier, the debugger points to the wrong line in the code.
How can I debug minified javascript embedded in the html?
One thing that might help is that you can set breakpoints in chrome w/o using the debugger directive directly in code. Simply view the prettified code output in the chrome sources tab, and then double click on the line where you want to add a breakpoint.

JS assets in a subdomain wont load on ff & ie but chrome is all good

We are building a Saas product and have purchased a bootstrap dashboard, all the JS/CSS assets are loaded though a sobdomain via our CDN.
Works perfectly on chrome but on ie and ff the components do not load properly, on ff I get the following errors:
TypeError: can't access dead object
ReferenceError: event is not defined
A link to a non working example is below (We don't want to give access to our working dashboard for commercial reasons) You can see the error when click on the "dropdown" menu item. As far as I can tell, all the assets are loading correctly.
http://hunchbuzz.com/acme/index.html
Any help would be appreciated.
Well, take your bugs one by one. Did you turn on the JavaScript Debugger when you tested your page in IE? In the F12 developer tools, select Script and then Start Debugging.
First there were a couple of errors in jquery.sparkline.min.js which I ignored for the moment. Then I tried clicking your 'dropdown' link and got this error:
SCRIPT438: Object doesn't support property or method 'preventDefault'
custom.js, line 3 character 1193
The highlighted code is (reformatted for readability):
$('.dropmenu').click( function(){
event.preventDefault();
// ...
});
Do you see the problem? What is event? The code should be:
$('.dropmenu').click( function( event ){
event.preventDefault();
// ...
});
The fact that it worked in any browser at all is probably due to the global event variable that some browsers create for compatibility with very old code.
Now back to the sparkline problems. I see it hitting two errors in jquery.sparkline.min.js, but with the minimized code the problem isn't jumping out at me the way the other one did.
When you're debugging, it would help a lot to load the non-minified versions of jquery.sparkline.js, custom.js, jQuery, etc. Then you'll have readable code to look at in the debugger, which should make it easier to spot these problems.

firebug script panel not showing any scripts

I am trying to debug my javascript & jQuery and step through it using firebug.
I am running my code on an Apache server (2.4) on a windows machine.
I used the firefox browser version 18.
When i go to run my code, I can't see my javascript (external file) in the scripts panel.
I see the linked jQuery library on the panel but I dont see my javascript code.
On the Firebug, the scripts are clearly linked in the HTML panel. But on the script panel, only the jQuery.js is visible. i would post a screen shot but i dont have enough reputation right now.
I dont know what is going on and what i have to do in order to be able to step through my javascript code.
UPDATE
I placed the "debugger" on my javascript code but it still not showing on the 'script panel'.
debugger;
$(document).ready(function () {
var email_default = "Enter your email address...";
$(':input[type="email"]').val(email_default).on('focus', function () {
if ($(this).val() == email_default) {
$(this).val(' ');
}
});
I also tried to do a browser refresh, disable and re-enable all the firebug panels- but it still won't show my external javascript. I had also double checked my file location & directories to make sure i am linking it correctly.
If Firebug (or other browser developer tools) doesn't show a JavaScript in the list of available scripts, this means it has a syntax error.
In that case you need to switch to the Console panel and check there for the error.
Notes:
As mentioned in a related answer, there can also be other reasons why there are no scripts shown in the list:
Since Firefox 49.0 and Firebug 2.0.18 the Script panel is completely broken. This is due to some internal Firefox API changes. And because Firebug is officially discontinued, this unfortunately won't get fixed anymore.
There was also a bug in Firebug 2.0.11 (and below) in combination with Firefox 39.0 causing this problem. This bug got filed as issue 7918 and fixed for version 2.0.12.
It happens when the Script panel is enabled and you close Firebug and then reopen it.

Categories

Resources