Debugging Javascript in Internet Explorer: display not updating - javascript

I'm trying to debug an intermittent, possibly timing-related drawing problem with JavaScript in Internet Explorer (IE9 including in IE8 mode).
Using the Developer Tools, I'm stepping through the lines that create, style, and display elements, but the actual browser window remains unchanged (and shows the Windows "Not Responding" title text much of the time), so I can't see what happens when.
With Firefox and Firebug, I can see the main window update at each step. But regrettably this problem doesn't occur in FF, so I can't debug there.
I've web-searched and looked at the MS articles on using the Developer Tools, but I can't find any discussion about single-stepping through JavaScript and seeing the results of each step. Is something wrong on my system, or is this just not possible?
32-bit IE9 on 64-bit Windows 7, in case that's relevant.

If you are able to step through the javascript code but the browser is not refreshing and crashing your best bet to debug it might be to isolate the problem. Say you are doing five things on a certain piece of code. Reduce that to just one thing and gradually pile up different process on top.
Not sure if this is the answer you are looking, but I have run into similar problem with IE 9 before so if you provide some code snippet which can be replicated I could help you further.
Update
If you are running into intermittent issues with IE make sure to add a meta tag so that IE doesn't load quirks mode after encountering something on your code. Add the following tag. More information here
<meta http-equiv="X-UA-Compatible" content="IE=edge" >

Related

Website with javascript doesn't work in IE9 but in IE9's compatibility mode - how to force compatibility view?

I know that there already is a question like this: Force IE9 into browser compatibility view
But since adding:
<meta http-equiv="X-UA-Compatible" content="IE=9">
to the the head section and reloading the page with ctrl+F5 didn't help there must be another way.
On my website is also a bxslider and according to this: bxslider not working in IE9 I replaced the elements (which had empty href attribute) with tags - still not effect. The images of the slider are displayed in full size one below the other. After activating compatibility mode the site works perfect.
I don't wanna rebuild my application from the scratch so what could I do to force the compatibility-view? Or is there at least a good free debugging tool for that? I downloaded the firefox addon IE Tab which has a debugbar but to use it you have to buy a premium version. I just don't know what is causing the error...
I found what was causing the error: Why does JavaScript only work after opening developer tools in IE once?
So frustrating and so simple. It was caused by the console.logs in the script. Without them it works like a charm.
If you use this code at the start of your JS (I use it in all my projects) https://gist.githubusercontent.com/elijahmanor/7884984/raw/console-monkey-patch.js it will override the console.log function so you avoid errors in IE but still get logging in modern browsers like chrome.

IE javascript issue fixed by chanding document mode?

Im maintaining a site that I didn't build. It works fine in all browsers except IE where im running into an issue which is quite hard to debug.
I have a modal overlay that you click to close. In my IE 11 browser it wont close. When I have the document mode in the IE dev tools to Edge or 10 it works fine, but 9 (Default) and 8 both don't work.
I cant provide a link to my site or share the code here. I know this isn't very helpful for solving my issue, but what types of issues could be solved by changing the document mode? Could IE's quirks mode be to blame here?
I know this is quite an open ended question but presumably there are a limited amount of issues that apply to my situation?
could quirks mode be to blame?
If you're in compatibility mode (ie doc mode is 10, 9, 8 or 7) then by definition you're not in quirks mode (which is doc mode 5), so the short answer to that part of your question is No, it isn't quirks mode.
However, compatibility mode can cause itself cause issues. The whole point of compatibility mode is that the browser pretends to be an older version of itself. So in doc mode 8, you have IE11 pretending to be IE8.
That pretence isn't hugely accurate (so don't think that you're seeing your site the same as a real IE8 user would see it), but it does mean that IE11 will switch off various browser features in order to make itself work more like IE8.
Therefore, if your code is relying on a browser feature that was introduced after IE9, then that would indeed probably break your site in doc modes 9 and below. But without seeing any code, it is absolutely impossible for me to speculate any further about which particular aspect of your code would be causing this.
The only thing I can suggest is that you might get some clues by checking the console for error messages, but in reality if you want help, then you're going to need to need to swallow that "I can't share code" issue.

Internet Explorer 9 appearance conflict

I have been researching all over the internet about this, and unfortunately cannot find out why this is happening. It seems to only be happening in internet explorer 9, on certain computers.
The entire page looks like a mess only in IE 9 (some computers):
The URL of the website is Here
Can anyone tell me why this is happening in IE9?
(NOTE: Compatibility view cleans it, but then the Js/jQuery doesn't work right).
For some reason, IE thought that the site was in my intranet, and rendered it in Compatibility Mode (there's a setting in IE to automatically render intranet sites in CM).
When I unchecked the box to "automatically detect intranet network", the site rendered correctly.
So your real question is how does IE determine the intranet network, and how can you force your page to NOT render in Compatibility Mode... something like this.
I noticed that you have blank space above your doctype. IE hates this. The doctype needs to be the very first thing in the file.
You also have over 2300 HTML validation errors that should be investigated and rectified. Again, IE is very sensitive to invalid HTML.
Going on a whim here, but I think it's the usage of inline-block. I don't have IE9 installed to a point where I can use it's developer console to further inspect, but IE is known to be very bad about displaying inline-block elements.
In Google Chrome's console, I am able to replicate the same appearance using float:left as opposed to display:inline-block, so that should solve that piece of the issue.
Edit: The only syntax issue I see with the HTML is the placement of the </head> tag, which is not adjacent to the <body> tag.
Edit 2: As far as the outlining issue goes, try using this answer to another question.
Edited yet again to fix the display of the tags.

How to speed up application running time in IE7?

We did an application using rails(2.3.4), ruby(1.8.2), MySQL, JavaScript, jQuery. This is handling minimum 6000 records. We showing those records detail in table. In the beginning Mozilla taking 2m to load the whole page. We did the cache, eager loading, indexes. Now Mozilla taking 25s to load the whole page. But IE-7 taking 1m30s to load the page.
We don't know why IE-7 taking too much of time.
Any one can help us to detect the running time in IE-7 and tell your guidelines to improve performance in IE-7.
Any add-on is available in IE7 to see the AJAX request time taken as like Firebug add on.
Use partial loading. Don't try to load the 6000 records at once, load them in smaller segments, when needed. Even 5 second loading is too long, not to mention the 25 seconds or 1m 30s.
Oh and yeah, IE 7's JS engine just sucks.
From Table Rendering - IE Blog:
When Internet Explorer encounters a table it measures all the content
of the table before rendering so that it knows what the widths of the
columns are to render the content correctly. On the other hand Firefox
uses a different algorithm in that it renders the table contents
progressively before it has all been passed.
You can improve performance by setting the CSS rule table-layout: fixed. The renderer will then calculate the layout based on the first row of the table.
IE7 is slow, there's no real way of getting around that basic fact.
I'm going to answer your second question (about debugging tools for IE7) because I don't think I can give any useful advice on your main point about actually speeding up IE7.
Any add-on is available in IE7 to see the AJAX request time taken as like Firebug add on.
The first thing to try is IE8 or IE9. These browsers have a Developer Tools window (accessible via F12, just like Firebug). It isn't as good as Firebug, but it does do quite a bit, and it is a useful debugging tool. It also has a feature which allows you to switch the browser into IE7-compatibility mode. The idea is that you can test IE7 from the relative comforts of IE8 or IE9.
The down side is that it isn't actually IE7. It's just a pretend ID7, and not a particularly good one at that. It may or may not replicate the speed issues you're having with IE7, and it certainly has known bugs and quirks of its own which don't appear either in a real IE7 or in IE8 in normal mode.
But all that said, it might be good enough for you to run some tests and get some answers.
A second suggestion might be to try Firebug Lite. This is a cut-down version of Firebug which runs as a bookmarklet in any browser (but generally IE). It doesn't have all the features of the full version of Firebug, because there's only so much you can do without writing a browser plug-in, but it does do a surprising amount. If nothing else, it does give you the console functions, which can be a life saver for debugging.
I hope that helps.

Javascript not working on IE 7 and IE 8 on Vista

An Example of this can be seen here:
http://nces.ed.gov/datalab/quickstats/default.aspx
Try clicking on one of the groups on the left and it should refresh the workspace with that group.
It works fine on all browsers in Windows 7 but fails in IE 7 and IE 8 on Vista.
I have this function:
function SelectGroup(gid, glevel, gtext) {
alert('not running on my environment only in vista');
}
And this is what calls it:
<a href="javascript:SelectGroup('3','3','Beginning college students')" style='text-decoration:none;'><span id='span_draggable_3' onmouseover="NavOver('3','3')" onmouseout="NavOut('3','3')" style='cursor:pointer;'>Beginning college students</span></a></div>
Some general suggestions:
Try to look if you have error messages, what do you mean by failed?
Try first with FireFox, it has better development tools.
IE8 has decent enough debugging tools, why wouldn't you use this?
Use a library like Mootools and JQuery to abstract differences between the major browsers
What about the old alert way of debugging things, have you tried it?
Try to narrow the problem the best you can, from my experience, this snipet is too big
edit: By telling in comments alerts don't run, it means you have an actual JS error somewhere and not a logic bug. Click on the error signal, bottom left of browser (yellow triangle with ! I believe), what is the message?
Edit: My friend, you have two other events I missed, What is the code of the onmouseover event, this might trash your code.
AND you have a </span> in the wrong place (no matching opening tag) this can also cause issues.

Categories