ordioxs / simplemodal

Automatically exported from code.google.com/p/simplemodal
0 stars 0 forks source link

Iframe with SimpleModal keeps breaking down in IE with jQuery 1.6.2 #73

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
SimpleModal or SimpleModal Contact Form (SMCF)? SimpleModal

Version of SimpleModal of SMCF (indicate Demo or WordPress plugin)? 1.4.1

Version of jQuery? 1.6.2

Browser/OS you are experiencing the problem with? WinXP, IE 8

I just upgraded jQuery to 1.6.2 and experienced SimpleModal breaking down IE8 
(the browser!) when trying to load an iframe as modal dialog with an relative 
url. Absolute urls seem to work.

Original issue reported on code.google.com by punkrat...@gmail.com on 30 Aug 2011 at 1:24

GoogleCodeExporter commented 8 years ago
I second that. Although my browser (IE9) is not crashing, what I'm experiencing 
sounds the same.

I have a page with jquery 1.6.3 and the latest simple modal script (1.4.1).
My modal 'call' looks like:

$.modal('<iframe src="BookDetails.aspx?id=' + id + '" height="' + winHeight + 
'" width="' + winWidth + '" frameborder="0" style="border: 0px;">', {
            containerCss: { height: winHeight, width: winWidth },
            zIndex: 10100,
            onClose: closeDetails
});

Which opens up the modal window just fine.
However, BookDetails.aspx does not contain a jquery reference, or any jquery 
reference for that matter. When I try to add the jquery reference I get a 
SCRIPT5009 javascript error. Most of the time it will say that 'Object is not 
defined' or 'Array is not defined'. The strange thing is that this will only 
happen when using IE9. It works fine under Chrome and Firefox.

It's fairly easy to try for yourself. Just open the Iframe demo you have on 
your own website (http://www.ericmmartin.com/projects/simplemodal/) and try the 
demo to open an external page in IE9...

Any thoughts?

Original comment by j.kokenb...@gmail.com on 8 Sep 2011 at 8:00

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I had the same issue too.... i think this issue is more to do with how IE9 
handles iframe and subsequent loading of javascript in it... my workaround was 
to set iframe src only 'onShow' callback function and somehow i stopped getting 
those object undefined errors. Hope this helps.

function onShow(){
   jQuery("iframe").attr("src", "/goto/site");
}

Original comment by dev.zav...@gmail.com on 12 Sep 2011 at 11:56

GoogleCodeExporter commented 8 years ago
upgraded to the latest version of jQuery (1.6.3) and the cursor just keeps 
spinning even though user is 'logged in'. same error using IE8 and latest 
Firefox on Mac. so i reverted to jQuery 1.4.2 and the problem is fixed.

Original comment by rudynik...@gmail.com on 14 Sep 2011 at 9:46

GoogleCodeExporter commented 8 years ago
It has been a while, but I thought I should post an update here.
I found that the solution provided by dev.zav (comment #3) solved my issue as 
well.

In stead of setting the src attribute directly in the iframe, I now set it 
during the 'onShow' event. I no longer receive 'weird' JavaScript errors...

Thanks for the suggestion!

Original comment by j.kokenb...@gmail.com on 15 Oct 2011 at 7:40

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I can confirm that dev.zav's comment #3 solved my issue too. My code ended up 
looking something like this:

$('.trigger-submodal').click(function (e) {
    e.preventDefault();
    function setSrc(){
       $('#iframeid').attr("src", "iframepage.php");
    }
    $.modal('<iframe src="" id="iframeid" frameborder="0">', {
        onShow: function(dialog) {
            setSrc();
        }
    });
});

Thanks guys!

Original comment by jaydedli...@gmail.com on 21 Oct 2011 at 5:49