We're trying to load the following URL into an iframe. For whatever reason, the site refuses to load properly the first time. (click to see what I mean). On reload, the site displays properly. Our solution, which works properly in some browsers (chrome and firefox) has been to force a reload with Javascript. The iframe source is declared in the HTML, so it should load the first time when the page loads. Its redeclared in jQuery, within a function which displays the hidden iframe. (to hide the iframe initially, we tried display:none, but I read that that can cause problems with iframes in some browsers, so we switched to visibility:hidden.)
In a nutshell, the problem is:
In Safari, we cant get the iframe to reload; all we see is the erroneous initial load of the URL. However, if we force a reload of the URL outside of our website, i.e. in it's own browser window, and then come back to our website, it works, presumably since safari has cached the url and has it onhand.
In IE, we see nothing. Blank iframe, also not responding to our forced reload.
Here's the javascript.
Code:
function cred_mi()
{
//this is the second loading of the iframe source, the first load happens in the html
$('#lightbox_iframe').attr('src', 'https://www2.dleg.state.mi.us/colaLicVerify/controller?searchType=detail&entityId=1240913&l2K=Y&licNbr=2101101211&licId=946445&detailType=Individual');
//other lightbox function handling
$('#control').empty().html('<a class="np" href="javascript:turnOff()">Close</a>');
$('#lightbox_img').css('display', 'none');
$('#lightbox_p').empty();
//display lightbox and iframe
$('#lightbox').fadeIn(500);
$('#scrim').fadeTo(500, 0.5);
$('#lightbox_iframe').css('visibility', 'visible');
//wait for all above to finish, and then force a reload.
$(document).ready(function(){window.frames('lightbox_iframe').reload(true);});
}
Last edited by chrishirst; 08-03-2010 at 05:56 PM..
|