Question

I have a problem with popups when I call iframe.

Here is a picture:

Picture of Mozilla popup

I don't want to get this popup.

This is my script:

function readfile() { 
alert(document.getElementById('iframe').contentDocument.body.firstChild.innerHTML);

This is the call from text link:

<li><a href="e90_data/sasija/prazno.txt" style="text-decoration: none" target="iframe_a">Prazno</a></li>

This is the iframe on the end of the page:

<iframe id='iframe' name="iframe_a" src = 'demo_iframe.htm' est.align="top" width=900px height=550px > <p>Vas browser ne podrzava IFRAME!.</p> </iframe>

On Chrome it appears normally, without a popup.

Was it helpful?

Solution

From MDN

From the DOM iframe element, scripts can get access to the window object of the included HTML page via the contentWindow property. The contentDocument property refers to the document element inside the iframe (this is equivalent to contentWindow.document), but is not supported by Internet Explorer versions before IE8.

I think you want to be using contentWindow.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top