Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jQuery load event loads sporadically in IE8 #8

Open
Mmjavellana opened this issue Aug 15, 2011 · 15 comments
Open

jQuery load event loads sporadically in IE8 #8

Mmjavellana opened this issue Aug 15, 2011 · 15 comments

Comments

@Mmjavellana
Copy link
Contributor

I was using the code this plugin is based on and I noticed that it worked sporadically in IE8. It didn't throw any errors, it just never fired the load event. Google brought me to this plugin, so I gave it a whirl. Same thing. Executing the plugin with the debug parameter showed me that it was never getting to the load event. As a quick and dirty fix for the site I'm working on, I ended up adding $.browser.msie to the opera/webkit check (Line 72, if ($.browser.safari || $.browser.opera || $.browser.msie){).

@house9
Copy link
Owner

house9 commented Aug 17, 2011

I don't see this in your repo anymore, did you remove it?
in most tests I have done it seemed to work with IE with out going through this code path?
I am a bit hesitant to make that change

@Mmjavellana
Copy link
Contributor Author

I never added this to my repo since it was, I feel, a pretty bad hack (unless it's the only way to fix it and then, well, it's still a bad hack). I just added it directly to the project I needed to use it in. I wasn't proposing it as a serious solution, just hoping to provide helpful information. Reading through my previous comment, I apparently left out a little bit of information that may help, so I'm going to reword the problem with that information.

The issue is that the load event was not firing, in IE8 only (maybe IE9, but I don't have that available for testing), for the iframes on specific pages within my site. It worked fine on all but two pages which are secure pages. The iframe content is also secure and includes the Comodo corner of trust logo. My only guess, and I don't see how this can even be the issue, is that the iframe is managing to load before the load event handler is added to to it.

If you are unable to reproduce this problem, I suppose it may be something unique in my project, but I don't know what that might be.

@house9
Copy link
Owner

house9 commented Aug 17, 2011

yeah, things do get finicky with iframes and the different possible content they contain

do you think something like a force delayed resize option would be helpful? false by default, but it could force all code execution down the $.browser.safari path if desired by the user of the library, just an idea

@Mmjavellana
Copy link
Contributor Author

Is there a way in jQuery to check if an object is already loaded? I couldn't find anything, but if so, then the solution I wanted to use for my project goes like this:

  1. Bind the load event.
  2. Check if object is already loaded and therefore won't fire the load event.
  3. Fire the load event.

I couldn't figure out how to do #2, but if it is possible, this might allow you to get rid of the $.browser.safari path completely.

@Mmjavellana
Copy link
Contributor Author

Oops, that wasn't supposed to be a link. :)

@Mmjavellana
Copy link
Contributor Author

I checked the latest code in my project, and it's still having that same issue in IE8 without my aforementioned hack. Also, it turns out that it has nothing to do with secure pages, it's happening on normal pages as well. The load event is being bound, when the iframe changes it resizes as expected, the initial load just isn't firing.

@house9
Copy link
Owner

house9 commented Aug 18, 2011

would it be possible for you to send me the rendered html - parent page and the nested iframe?

@Mmjavellana
Copy link
Contributor Author

I'll send you a message with a link to the page. If you still prefer the rendered html, let me know and I can do that too.

@adamjgray
Copy link
Contributor

I'm actually seeing something similar in ie9 after I added the tag to the header. Or rather, I changed it from ie7 to edge. From what I'm seeing in the network capture, it looks like ie9 is aborting the request for the iframe contents (presumably because it already has them and they aren't expired yet?) I'm guessing that because of this abort, the load event isn't fired because it wasn't "loaded" it was just inlined. Adding ie to the browser check for browsers to kick in the nuts and force the iframe navigation seems to do the trick. A dirty hack to be sure, but that's better than my iframe not showing all the contents it needs to.

@withremote
Copy link

I just tested on browserstack.com and XP IE8 and lower doesn't expand the frame. Windows 7 IE8 does work though.

@house9
Copy link
Owner

house9 commented Feb 1, 2013

@withremote - can you create a gist with the markup/js code that doesn't work

  • Thanks

@withremote
Copy link

https://gist.github.com/4693420 is the code not working in IE8 XP

@house9
Copy link
Owner

house9 commented Feb 1, 2013

is it being served up via webserver? i.e. localhost or other, could be browser security issue if served from the local file system

also - if you declare the iframe markup before the script, you don't need it wrapped in $(document).ready, it will resize when the iframe load event occurs; not sure if that will solve this issue?

@withremote
Copy link

Removing the $(document).ready fixed it apparently, thanks!

@claudia1204
Copy link

it didn't resize height in ie9/8 when iframe's src was changed.
solution 👍 ended up adding $.browser.msie to the opera/webkit check (Line 72, if ($.browser.safari || $.browser.opera || $.browser.msie){).(by first comment Mmjavellana,thanks! )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants