Javascript hangs in IE unless in debug mode - javascript

I'm building web a javascript application using jquery, knockoutjs and less (for css).
Works fine in all browsers, except IE 9 (only tried IE 9).
It simply never starts. Nothing from the templates are shown. Unless i press F12 for debug and refresh. Then everything works fine, also works if I close the debug window and refresh. Right until next IE restart.

Are you using console.log anywhere? That will break in IE unless the debug tools are open.

Related

How to debug infinite loops in Firefox/Firebug?

I have an issue with Firebug in Firefox. While my JavaScript produces an endless loop, a popup in Firefox comes up, which allows to continue the script or terminate it.
In earlier versions of Firefox there was an additional option allowing to debug the script, however it is not appearing anymore in the popup in current versions (I am using Firefox 31.0).
Using this option Firebug should stop somewhere in the JavaScript processed in the endless loop. Most likely this behavior can be again activated in Firebug/Firefox but I do not know where?
While this button is not present in Firefox 31.0, it is there in version 32.0. Though instead of stopping in Firebug it now uses the built-in debugger to debug the script.
Background info:
Before version 2.0 Firebug used Firefox' old debugger API called JSD. In Firefox up to version 31.0 the Debug script button is just displayed when that API is enabled, i.e. when Firebug (1.12.* and earlier) is opened for that page.
The debugger of the built-in devtools and Firebug 2.0 use a new debugger API, so as the button is bound to JSD it is not displayed.
In Firefox 32.0+ the button works together with the new API. Though as Firebug (2.0.*) doesn't hook into the logic for that button, it opens the built-in debugger.
There is currently no way to stop the script execution on hanging scripts. There used to be a button to debug them, though it got removed in Firefox 45.
The enhancement request to re-add it is https://bugzil.la/1157820.
For what it's worth, here's a simple test script creating an infinite loop:
data:text/html,<script>while(true){x=1;}</script>
Edit:
There is still a Debug Script button in the Firefox Developer Edition, though it doesn't seem to work (at least in the tested version 81.0b9) trying it with the simple script above.

Internet Explorer Javascript not running from event issue

I am trying to get an function to run from an event listener on a form submit.
Chrome & Firefox (Iceweasel) work fine with this code. Internet explorer (Version 9) for some reason requires me to open up the developer tools and close it down straight away for the javascript to work, after the page can be refreshed and the code works fine.
The site is published at http://itdipext.ryanteck.org.uk/enquire.html and the javascript is at http://itdipext.ryanteck.org.uk/javascriptValidate.js
Why Internet Explorer 8?, Heck why javascript for basic form validation?
This is for a college assignment where HTML5 does not even exist yet. And internet explorer to make the teacher happy.
Thanks -
Ryan Walmsley
It looks like its due to the heavy use of console.log in your script.
IE doesn't create the console object until dev tools is open. You can add this to the top of your script to stop it breaking
var console=console||{"log":function(){}};
Be aware it wont log anything to the console with this in place.

debug javascript in MVC 3 View

Can we set a breakpoint in javascript(jquery) code in a asp.net MVC 3 view?
I want to debug it because I have to.
I used F12 in IE 9 but no clue.
Visual Studio doesn't play very nicely with javascript debugging, and neither does IE.
Try using Firefox's Script tab in FireBug, you can set breakpoints there and then refresh or reload the page to hit the breakpoint. It allows step by step execution.
Or in chrome, try going to sources, then with the small icon in the top left of the tab, select the script you want to debug. Clicking on one of the line numbers will set a breakpoint for that item. You will notice that when clicking refresh after doing this there are a few options. Any will do, but a normal refresh works to hit the breakpoint.
You can use developer tools of your browser.... just press F12 (chrome, ie)
must set the break points on the js source... and play with your page.
I use chrome... Chrome developer tools tutorial

Javascript and jquery work with IE

My html page cannot work in IE browser. If I turn F12 developer tools on, it starts to work. My page can work with chrome. I guess it is caused by jquery and javascript. Can anyone know how to make it work? Thanks
IE crashes your script if you're using console.log anywhere inside it. Developer tools adds the console functionality - therefor it works if you open it. Remove the console.log and it should start working just fine.
Chrome/Firefox support this by default, thats why it works there no problem.
you're probably using console.log() in your code somewhere. In IE console object doesn't exist unless the dev tools window is active.

I have a very Unique issue with IE 7/8/9 and JavaScript Jquery

I have a very Unique problem with IE 7/8/9 and JavaScript. My problem is I am using a script called plupload - I am kinda married to the script currently and can't ditch it for something new and or better.
What my problem is, is when I add files to the script via the file dialog in IE and hit cancel instead of selecting a file. The button (well link that forms a button) seems to lose its functionality. This is only in IE, this has been tested across Mac, Linux 10.04 and 11.10, Windows XP, Vista, and Windows 7 (across about 17 different machines). On Chrome, Safari, Firefox and IE. This bug only occurs in IE on any windows platform. Does anyone know what might be causing the issue, anyone else ever use plupload that has experianced this?
To me it seems that the dialog takes focus off the browser, then doesn't give the the browser back focus properly unless you actually select a file. Seems at that point almost all javascript stops working but its really just the javascript that controls this button, which is pluploads own script.

Categories