Blank Iframe in Ie

Blank iFrame in IE

I would start by reading this Another Cross Domain iFrame Communication Technique and then look at a more elegant AJAX solution. I have seen a lot of situations where cross-domain iframes just don't work (and for good reason).

IFrames are one step above IE in the Axis of Evil (IMO)

Can't access an about:blank iframe in IE after the document.domain changes

Are you happy to change the domain of the iframe to? The following works (for me) in IE7,9

document.domain = 'jshell.net';

var iframe = document.createElement('iframe');
document.body.appendChild(iframe);
iframe.src = "javascript:document.write('<script>document.domain=\"jshell.net\"</script>')";

// Now write some content to the iframe
iframe.contentWindow.document.write('<html><body><p>Hello world</p></body></html>');

Edit: If this is inline script on a page then you need to split the closing </script> tag up. See why-split-the-script-tag

IE7 iframe blank page

If you are using ASP then add this code

Response.AddHeader "p3p", "CP=" & chr(34) & "CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR" & chr(34)

in all the pages which are loaded in the iframe

Web page that contains frames is shown as a blank page in Internet Explorer

You can use iframe.contentWindow.document.write() to embed HTML in iframe. The sample code is like below:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<iframe id="iframe1">
</iframe>
<script>
var iframe = document.getElementById('iframe1');
iframe.contentWindow.document.write("<html><body>Hello world</body></html>");
iframe.contentWindow.document.close();
</script>
</body>
</html>

iframe in IE going blank

While Chrome and FF leave the page there, this does actually make sense.

You are posting back to the server, then clearing your whole output, placing a file in the stream and sending that. Technically I would say IE is right in blanking out the page.

This is assuming your download button is in the iframe?

The solution I would try is putting that download link in another iFrame or have another page that downloads it and when you press a link it opens the new page which just outputs a file. So the window flashes up but then it disappears and a save dialog button appears. However popup blockers might try to stop this.



Related Topics



Leave a reply



Submit