<head>
<script language="javascript" type="text/javascript">
function openMe()
{
var win = window.open("about开发者_开发知识库:blank");
var str="";
for(var a in win){
str+=a+"<br/>";
}
document.getElementById("data").innerHTML = str;
win.document.write("Karandeep Singh");
}
</script>
</head>
<body>
<div>
<input type="button" value="OK" onclick="openMe()"/>
</div>
<div id="data">
</div>
The above code is open a document and write on it. but it is not working in safari.
you need proper html...
do it like this,
demo
function openMe()
{
var win = window.open();
var str="";
for(var a in win){
str+=a+"<br/>";
}
document.getElementById("data").innerHTML = str;
var windowHTML =
"<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>\n" +
"<html>\n" +
"<head></head>\n" +
"<body>Hello World</body>\n" +
"</html>";
win.document.write(windowHTML);
win.document.close();
}
精彩评论