Iframe content not loading in firefox - javascript

I have iframe in my pop up. the content of iframe's set by
$('.document-acceptance-container .documentIframe')
.contents()
.find('body')
.html(this.model.get('data').DocumentRecord.DocumentBodyPath);
It work's fine in Chrome and content of iframe is loaded, but in firefox iframe is empty. I set
security.mixed_content.block_active_content to false and disabled addblock.
But it didn't help me.If I set a breakpoint on this line in debug mode in firefox - content was loaded.
Have you any idea?
P.S: DocumentRecord.DocumentBodyPath is html code

Related

<object> onload not firing in Chrome

Loading a PDF in an <object> tag, I want to show an indicator while the document is being loaded instead of just an empty element, so I positioned a Load Panel over the <object>. I added a function to hide the panel:
function documentLoaded() {
// Code to hide panel here.
}
And set it to fire in the onload event of the <object> tag:
<object type="application/pdf" data="/documents/sample.pdf" onload="documentLoaded();"></object>
This is working exactly how I want it to in Firefox and in Edge, but when I tested it in Chrome the Load Panel never went away. When I debugged it I saw that the documentLoaded() function was never called at any point.
Is there another way to get this to work with Chrome, or another way completely to call a JS function once the PDF is ready?
document.querySelector('#load_panel').onload=documentLoaded()

Setting content of iframe using javascript fails in firefox

I'm trying to set the content of a iframe using javascript.
I've the html string. And I'm writing:-
var iframe = $('iframe')[0],
content = '<div>test</div>';
$(iframe).contents().find('html').html(content);
It works fine in google chrome, but in firefox is shows the content for a moment and the disappears.
Please help me to fix it.
I faced the same problem. I saw the load function of iframe fires in firefox but not in chrome. So firefox reload the iframe again on load event.
So with your existing code try this:-
$(iframe).load(function(e){
$(iframe).contents().find('html').html(content);
})

Sandbox iframe attribute isn't preventing redirects in FIrefox

I'm trying to get iFrame sandboxing to work, and Firefox is giving me trouble.
<iframe src="" scrolling="no" sandbox=""></iframe>
I use jQuery to set the iFrame's src attribute to one of several different pages. But my target pages have JavaScript in them that makes them break out of my iFrame. I counter that with the sandbox attribute, which is supposed to prevent JavaScript from running inside the iFrame. This works great in Chrome and Internet Explorer, but in Firefox as soon as I load the target page into the iFrame it takes over the whole window.
Firefox's documentation says it fully supports the sandbox attribute. Am I doing something wrong? Installing NoScript and telling my browser not to run JavaScript from the target site makes everything work fine, but obviously I don't want Firefox users to have to install an addon before my site will work.
If you are manipulating or setting the sandbox attribute after the iframe is in the DOM, it will completely ignore the setting. You must set it before the iframe element is added to the DOM.

location.hash inside iframe not working on Firefox

I'm trying to display an HTML5 slideshow inside an iframe (based on Google's html5slides). The current slide number is set in the URL hash to be able to directly jump to it.
But it doesn't work in Firefox. The tricky part is that I populate the iframe's content using javascript, so my iframe doesn't have a src attribute. When I load my slideshow's code in the iframe, it is correctly displayed on Chrome, Opera, Safari, even IE9. But on Firefox it loads for a split second then loads my parent page inside the iframe.
I suspect that setting the hash inside the iframe doesn't work in firefox because I have no src attribute (I tested with an empty src attribute and it's the same)
So is there another way to set the url's hash of an iframe in javascript that would work with firefox?
You can see the bug in firefox if you paste this page content's in jsbin.com with real-time preview: http://html5slides.googlecode.com/svn/trunk/template/index.html
In firefox jsbin will load itself inside the preview iframe.

iframe content not appear

I have this code and sometimes works and sometimes not:
var urlThemes2="../usuarios/"+parent.parent.parent.Nb_Global_usuario+"/aplicaciones/"+parent.parent.parent.Nb_Global_aplicacion+"/appfiles/includes/themes/";
alert("preview")
$("#listaTemas2").attr("src","Nb_ListaTemas.php?urlThemes="+urlThemes2);
In the Chrome's inspector shows the iframe's "src" defined, but not the html content.
Any solution?
Thanks,

Categories

Resources