How to create infinit Iframe containing itself page?
So I try
document.write('<iframe src='+ location.href + ' width="468" height="60" ></iframe>');
But it seems not to be working at chrome...
This also does not work
<div id="main"></div>
function $(id)
{
return document.getElementById(id);
}
var div = document.createElement("iframe");
div.setAttribute("src", location.href);
div.setAttribute("width", "500");
div.setAttribute("height", "90");
$('main').appendChild(div);
document.write(location.href);
And this does not work
function $(id)
{
return document.getElementById(id);
}
document.write('<div id="main"></div>');
var div = document.createElement("iframe");
div.setAttribute("src", location.href);
div.setAttribute("width", "500");
div.setAttribute("height", "90");
$('main').appendChild(div);
document.w开发者_Go百科rite(location.href);
<iframe src="about:blank" onload="if(!this.t){this.t=1; var href=location.href.replace(/[\?\&]inf\=.+/i,''); href += href.indexOf('?') > -1 ? '&inf=' : '?inf='; this.src = href + Math.random();}"></iframe>
I tried on chrome.. seems ok :)
Edit
appended some regex for safe url
Looks like most browsers block that option, which is probably a good idea.
Tested with the code:
<iframe src="."></iframe>
On Chrome, I get this page:
http://jsbin.com/epimi4/
精彩评论