Hidden Google Doc iframe won't load -
on webpage, i've got several tabs and, in 1 of them, want display iframe containing google doc. when iframe displayed, google doc loaded , there no problem. default, tab hidden (so, iframe inside too)
something like
<div id="tab-1">...</div> <div id="tab-2" hidden>...</div> <div id="tab-3" hidden><iframe src="https://docs.google.com/document/d/......../edit?usp=sharing&embed=true"></iframe></div>
with jquery handle actions
and, when iframe hidden, seems can't load until it's not hidden anymore. problem endlessly popup saying
this error has been reported google , examined possible. continue, please refresh page.
- in page without tab, if iframe has "hidden" attribute, bug occurs too
- i around problem "hiding" iframe "heigth=0" when it's hidden in tab, problem comes back
have ever met problem , find way solve ? have "dynamically load" google doc iframe when becomes visible ? (and then, how ?) thanks
i don't mind if iframe loaded later decided load <iframe>
jquery, when tab opened, storing src attributes.
there problems though, if tab closed while iframe not loaded. that's why prevent stop loading if tab changed, (and don't if it's loaded.)
html
<iframe data-src="https://docs.google.com/document/d/......" class="google-doc"></iframe>
jquery
//stops iframe loading $(".tab-to-close iframe.google-doc").not('.isloaded').prop('src','') //change tabs $(".tab-to-close").hide(); $(".tab-to-open").show(); var iframetoload = $(".tab-to-open iframe.google-doc"); //load iframes on new tab iframetoload.prop('src',iframetoload.data('src')) //if it's loaded in time, save it's not destroyed on tab changing iframtetoload.on('load', function(){ $(this).addclass('isloaded'); });
Comments
Post a Comment