Sometimes you want to load other web page in your website's iframe, but due to…
How to send body to iFrame cross domain
The <iframe> HTML element represents a nested browsing context, embedding another HTML page into the current one. By doing this, you ca display a secondary webpage on your main page.
iFrame can make your web page slow and pose a security risk, especially if you use content from a suspicious website.
How to send body in iFrame
<div id="container">
<form id="loginForm" target="myFrame" action="http://localhost/page.php" method="POST">
<input name="If-Unmodified-Since" type="hidden" value="Tue, 1 Jan 2013 12:00:00 GMT" payload="_header"/>
<input type="text" name="j_username" value="login fsf" hidden="hidden" />
<input type="text" name="j_password" value="password" hidden="hidden" />
<input type="submit" hidden="hidden">
</form>
<iframe name="myFrame" id="output-frame-id" src="" style="height:100%;width:100%;" title="Iframe Example"></iframe>
</div>
function formAutoSubmit () {
var frm = document.getElementById("loginForm");
frm.submit();
}
window.onload = formAutoSubmit;
How to allow your web page access cross domain in iFrame
To allow your web page cross domain in iFrame you need to add this code into .htaccess or you can add it in your web server configuration.
Header set X-Frame-Options "allow-from *"
[…] how to send header to iframe cross domain, we would like to recommend you to read this topic first How to send body to iFrame cross domain. This will tell you the way the you can send body in iframe cross domain. In some case, you not […]