Javascript not working on IE 7 and IE 8 on Vista - javascript

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.

Related

Cursor jumps in the beginning of the input line after each letter in 1 millisecond in browsers on some sites (e.g.Youtube comments field)

AS I typing a letter in the field in 1 millisecond cursor jumps in the beginning of the line of typing field so that text is typed invert-(I only can send some message on particular sites(you tube comments and https://translate.yandex.com/ for example after typing it in notebook, copying and pasting in youtube comments). I try to understand it hard and up to this moment I've learnt that it relates to CSS and particular line appears while it stops (). Please help me to understand on my low level of knowledge how can I stop this problem. Where I can reset settings on my win 10 system to stop my two browsers to act this way. (It started to occur after I deleted cookies of a couple of sites and win defender says no viruses..).
I tried to learn how to implement (or encode) a script that some people put forth on some sites into in-built system but I failed up to this moment and it disturbes me. 1) what code or script 2)where or how to paste it or type in as I imagine it should be to solve the issue. I've learnt how to read scripts in browsers (shift+ctrl+I) and they call it css in js and I compared to pages where issue stop to occur when I deleted some lines with div(many tries and I understood by comparing) and reloaded and the problem disappeared when div was set typing settings to default(). Sorry for being so prolix as I'm from the opposite hemisphere, lerned English and not quite sure wheather to be understood. As this drilling my mind I can't do anything but finding solution. Thank you, hope you understand.
If you only use Chromium-based browsers, then you should see if the problem also occurs in a Gecko-based browser. If the error only occurs in Chromium based browsers, then it must be a Chromium bug. Otherwise it can only be the system.
Chromium based browsers are e.g.:
Google Chrome
Opera
Edge
brave
Gecko based browsers are e.g.:
Firefox
Goal
You can find more information on how to report a bug in the Google Chrome Help Center here.
So, I have just managed this problem cause my mind coldn't set still.. I noticed that when I used the Linguist translator extension that was installed on both of my browsers Edge and Chrome for translation of from native language it just couldn't stop translating changing letters and the pattern was some bold letters in the beginning of sentences which also occured in typing on site input fields and youtube auto-generated subtitles. I removed extensions and the problem ceased to manifest itself.

JS Bookmarklet Not Working in IE11

long time lurker, first time poster.
The basics are this:
Inspired by this blog post, I'm attempting to create a bookmarklet for our QA team to quickly populate a form.
The bookmarklet works perfectly on my machine (TM) in Chrome, IE 10, and IE 9 compatibility mode. I've tested the bookmarklet on the QA team's machines, and while it works fine on their Chrome browsers and on IE 9, the bookmarklet doesn't work on the two machines running IE 11.
Details:
Of the two machines running IE 11, one is on Win 7, the other is on Win 8.1. The machine running IE 11 on Win 7 is updated to IE version 11.0.9600.17207IS, and will also run the bookmarklet correctly in Chrome.
I've attempted a couple different variations, the first based on the CSS-Tricks blog post mentioned above.
<a href="javascript:
(function(d) {
var body = d.getElementsByTagName('body').item(0);
var script = d.createElement('script');
script.src = 'https://company.siteurl.com/unrelated/DisclosureRegister.js';
body.appendChild(script);
}(window.document));
alert('Bookmarklet js fired!');">Disclosure Register Bookmarklet</a>
The second, based on a StackOverflow Response, is as follows:
<a href="javascript:
(function(){
var s=document.createElement('script');
s.type='text/javascript';
s.src='https://company.siteurl.com/unrelated/DisclosureRegister.js';
document.getElementsByTagName('head')[0].appendChild(s);
}());">Disclosure Register 2</a>
Both codes work on my machine in the previously mentioned browsers, neither work in IE 11 on the other machines (I don't have IE 11, can't test it directly on my machine).
I get no error message in console in the developer tools, and the DisclosureRegister.js file isn't listed in the developer tools' file list. It appears that the bookmarklet simply isn't firing.
Neither one of those bookmarklets have a Web Documents tab when I right click > properties, however, a simple javascript alert bookmarklet I provided them with does have the Web Documents tab, and it works perfectly in all browsers (including IE 11).
Click me!
I'm delivering the bookmarklets by writing the html in Codepen, emailing them a direct link to the Codepen (I don't have enough reputation points to post the link), and having them drag the link from the Codepen output to their browser favorites bar.
I came across something that gave me hope it was a bug with an older version of IE 11, but the IE version being used is even newer than the version that fixed the related bug.
Just in case there's something in the DisclosureRegister.js file that's causing IE 11 to abort the javascript, I'm including the code for that as well:
(function (win, doc, $, undefined) {
//Don't run if jQuery isn't loaded
if (typeof window.jQuery === 'undefined') {
return;
}
alert("Script is being called!");
}(window, window.document, window.jQuery));
The question:
While I'm certainly not ruling out an error with my code (and of course, please correct me if it's wrong), is there anything peculiar with IE 11 in the way it handles javascript bookmarklets that I need to account for in the code?
Thanks in advance for your time!
I wrote that article. Really glad you guys are finding it useful.
It seems there a bunch of people complaining about bookmarklets not working properly in IE11. One thing I'd test is how IE11 handles same origin policy. Check out this link, and see if you can temporarily disable same origin policy. Then test.
Obviously it won't solve the problem, but it could lead you in the right direction.
Hope that helps a bit. Let me know.
I think I found what is the problem with bookmarklets in IE11. I just added a bookmarklet in IE11 and it wasn't working so I started googling and found this page. Then I found bookmarklets at Microsoft's own website where they actually recommend to use it and it works. Then I decided to check if the syntax is correct and this where I found a problem. For some reason IE cuts part of long bookmarklets when it adds it to the toolbar by draggin-dropping. My bookmarklet that I was tried to add was several brackets short of original and because of that the syntax was incorrect. I then copy-pasted full code manually and it started working.
I was able to resolve the same problem by removing all line breaks from the bookmarklet code. IE 11 apparently doesn't know how to handle them.
With line breaks in the bookmarklet code, after adding it to "Favorites" the properties showed a blank URL and nothing would happen when clicking it.
With the linebreaks removed (ran a regex to collapse all whitespace to a single space character), after adding it to the "Favorites" the properties show the correct javascript in the URL field and it runs correctly when clicked.
I wasn't able to find anything anywhere documenting this limitation.

Debugging Javascript in Internet Explorer: display not updating

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" >

Debugging JavaScript VS 2008

I am debugging 12K lines of JavaScript. Of course it is written by the off shore team. Now, I need to find out which js function is invoked when I interact with the UI. Is there anyway for me to just automatically jump into the function which is being executed?
I cannot really put a break point since I have no idea where to put the break point?
App runs only on IE7!
You can attach VS 2008 to a scripting host process like Internet Explorer. Notice that "scripting host" is specific to the Windows Scripting platform, which isn't used by other browsers.
Internet Explorer should be configured to "Allow script debugging" so that VS can attach to iexplorer.exe and be able to debug scripts running in it.
Bear in mind that this is an extremely frustrating debugging experience. If you can debug in more modern browsers (including IE9, which has decent developer tools), please do so!
Once you've attached Visual Studio to IE7, you can use the Break All option to terminate any running scripts. If no script is running, it will break the moment a script is executed, such as if you hover over an element with the mouse that has an onmouseover listener.
This might get somewhat cumbersome if you are looking for a specific piece of code. I don't think there's really a way around this besides just tracing through the code until you find the part that's relevent.
If this is a bug that happens when you click on a button, for example, look at the HTML code for the button. If it has an onclick handler, search for that function and set a breakpoint there, or add the word debugger; to the top of the function. If there is no onclick handler, search for the ID of the button in your Javascript code and see if any listener is bound to that DOM element.
There's really no reason why 12,000 lines of Javascript code should thwart your efforts to see what's going on. Find a repro for the issue, and then use Find to locate the relevant code in your Javascript file. Also, I realize your site might not work in Firefox or Chrome, but it might work in IE8 since it's fairly backwards compatible. IE8 has a better debugger and also the ability to explore various DOM elements which could come in handle for tracing what code is run where.
Hope this helps!

How to know what javascript function is called?

I have a SharePoint website with menus and everything.
I want to know what JavaScript function is called when I click an item.
How to know that? Is there any tool to trace javascript functions called? I use IE
Thanks a lot
I know this may not be the best help as you are not a chrome/firefox user. However, if you do chose to switch over, the Google Chrome browser has a script checker built in, which catches everything that you want to console.log().
This is simular with Firefox, however, firefox you have to download the addon "fire-bug" which can do the same, but it does not come pre-installed.
IE has an inbuilt 'program' called developer tools, which could be what you want, however I believe this came in through the later stages of IE such as IE 8+ (don't quote me on that)
You can use debugbar to inspect HTML element and also find what JavaScript function is called, then you can use Microsoft debugger, to put a breakpoint into the function and debug.

Categories