I have an HTML page that has an embedded javascript file that for some reason or another I cannot debug. I can click on the error line to go to the location in the code but once there I cannot actually set a breakpoint inside the IE 11 debugger. I can however set a breakpoint in the HTML which isn't helpful to me.
I've read similar posts on the topic but they haven't helped. I've unchecked the box that disables script debugging in the IE 11 options.
Does anyone know what could actively prevent the debugging from happening? Even console.log lines aren't making it through...
Thanks.
edit: the exact error I'm getting is SCRIPT1010: Expected identifier on an Object.entries().forEach call that I've already added the necessary polyfills for.
Related
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.
I set a breakpoint in a script block of a razor view.
VS2012 attaches to IE but breakpoint has yellow triangle with exclamation mark saying:
The breakpoint will not currently be hit. The code in the document is
not loaded.
Script debugging is enabled in Internet Options of IE.
Have no idea what is wrong.
I faced this problem too. After trying many codes and things take from different posts in Stackoverflow and others websites, they have not solve my problem. When i have take a look for #robert4 solution and go back in my javascript code, i saw one error and fixed it, by doing like that, i have finally solve may problem and can now get a breakpoint in my javascript document. For those who will face this type of problem, i think that the first thing to do it is to verify your js file code by code to see if there is no error before beginning to implement each of others solutions take from differents posts.
When I had similar issue it turned out that an omitted } was the cause
(in one of the JavaScripts of the page, one of the {}s was not closed).
There was no error message on the browser console at all,
just didn't work and I had no clue for half an hour.
When I fixed the missing }, everything began to work as expected.
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.
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.
This question already has answers here:
How can I debug my JavaScript code? [closed]
(20 answers)
Closed 6 years ago.
I have some old javascript code from around 2000-2002 which (surprisingly) still works in IE, but doesn't in Firefox, Chrome, Opera etc. I already found out about some quirks, some browsers do some things this way, some another. So there are code snippets on the internet to create some browser plattform independent function that does it.
Now my problem is, to even locate the problems. Right now, there are buttons in the website, when I click them, something happens in IE, but Firefox does just nothing. There isn't even an errormsg. I tried stepping through the javascript Firebug, but at some point in the code, when I do the next debug step, the script just seems to abort, without any error message. It doesn't continue with the next statement. Pretty strange and I have no idea what causes it or how to fix it. :/
So how do I debug javascript so I get error messages telling me what the problem is, for example, what function/variable I'm using isn't defined in firefox or when I use wrong parameters.
Thx & Best regards
Marc
Firebug for firefox is okay. The console for safari and chrome, IMO, is better. In either case, right click the page, hit "inspect element," and click the "console" tab in the pane that pops up. Now you'll see any errors and warnings generated by the page.
If you really want to debug the scripts you can click on the "Scripts" tab and either pause execution immediately or set a break point. Then, you can step through the execution of the script line by line, inspecting the call stack and watch list as you go.
Firefox doesn't popup error messages or put them in the status bar (like IE). You have to open the Error Console to see the errors.
Firefox puts Javascript errors in the Error Console, but also HTML and CSS errors and warnings.
As to what might not work in the code, there are plenty of things that are IE specific and won't work in any other browser. Also there is a big difference between IE in quirks mode and IE in standards compliant mode. Put a proper doctype in the page so that it's rendered in standards compliant mode, which will make IE more like other browsers, and some IE-specific quirks are removed. This might cause your old script to stop working, in which case you know that it's likely that it's some IE-specific feature that causes the problem.
There's FireBug, but it only works for Firefox.
EDIT: Doh, you already mentioned this in your question.