Jump to content
Lucy

IE8 attachEvent order

Recommended Posts

I'm using several Javascript files with (for IE8 and below) window.attachEvent("onload", function). In Firefox, using addEventListener, everything loads as I'd expect. The load function for each file happens in the same order as the files are listed. However, in IE8 the order is wrong. The files are definitely loading in the correct order, but the onload functions don't. Which is a slight problem, as there are a couple of things that depend on the other files. Does anyone have any experience with this?

Share this post


Link to post
Share on other sites

IE8 and below...really, why? even they admit these are the worst effort of browser ever which ruin their reputation and brought them now to less than 10% statistically browser usage, they are now trying to rebrand from IE name to Spartan (IE in pink spandex).

Share this post


Link to post
Share on other sites

What exactly are you doing? Do you have functions that load external files and then do something once it finishes loading?

Share this post


Link to post
Share on other sites
IE8 and below...really, why? even they admit these are the worst effort of browser ever which ruin their reputation and brought them now to less than 10% statistically browser usage, they are now trying to rebrand from IE name to Spartan (IE in pink spandex).

I know, I know... but still, 10% isn't a tiny number. I'm trying to get freelance work in web development, and want to be prepared for any clients who ask me to support earlier versions of IE. Life would be so very much easier if it didn't seem necessary...

 

What exactly are you doing? Do you have functions that load external files and then do something once it finishes loading?

I have a few files with a function added to the onload event. The first file detects certain elements that only show up on mobile screen sizes and assigns them to variables/uses them, etc. The other files, which load afterwards, were to use some of these to avoid repeatedly assigning variables... but in IE8, the first files' onload function doesn't actually fire until after that of the other files. It's not that important, I suppose, it just seems a bit messy having to do it this way.

Edited by Lucy

Share this post


Link to post
Share on other sites

With a lot of issues with IE it's almost not even worth it to try and figure out what it's doing and why, I typically just go straight for a workaround. One possibility would be to have the other functions check if the first one has executed yet (I assume it would set some variables or things that the other ones could detect), and if it hasn't executed yet then use setTimeout to schedule the function to run again after a few milliseconds.

Share this post


Link to post
Share on other sites

2015 Total IE 11 IE 10 IE 9 IE 8 IE 7 May 7.1 % 4.1 % 1.1 % 1.2 % 0.7 %

0.1 %

 

NOT less than 10% for IE8, but overall, 0.7% for IE8, again! why support this? its time to finally bury this monstrosity of a browser.

Share this post


Link to post
Share on other sites

It depends on where you're getting the numbers from, I wouldn't use W3Schools as a reliable source. They even have a disclaimer at the bottom of the page:

W3Schools is a website for people with an interest for web technologies. These people are more interested in using alternative browsers than the average user. The average user tends to use the browser that comes preinstalled with their computer, and do not seek out other browser alternatives.

 

There are still many people who use IE8. I wouldn't support IE7 or under, though.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...