Skip to content

Instantly share code, notes, and snippets.

@z007
Created October 21, 2014 03:10
Show Gist options
  • Save z007/3ead8a9fc1add3c427fc to your computer and use it in GitHub Desktop.
Save z007/3ead8a9fc1add3c427fc to your computer and use it in GitHub Desktop.
IE打开空白页window.open()正确 window.open("text/html","replace")不可以 但在360 火狐 google浏览器则可以
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> IE打开空白页window.open()正确 window.open("text/html","replace")不可以 但在360 火狐 google浏览器则可以 </title>
<script>
//
function createDoc()
{
//正确
/*var w=window.open()
w.document.open()
*//*//正确
var w=window.open()
w.document.open("text/html","replace")*/
/*//错误
var w=window.open("text/html","replace")
w.document.open()
*/
/*var w=window.open("text/html","replace")
w.document.open("text/html","replace")
*/
/*w.document.write("<h1>Hello World!</h1>")
w.document.close()
*/
var w=window.open()
var s= w.document.open()
s.write("<h1>Hello World!</h1>")
w.document.close()
}
</script>
<script>
function open_win()
{
window.open();
}
</script>
</head>
<body>
<input type="button" value="New document in a new window" onclick="createDoc()">
<input type="button" value="Open Window" onclick="open_win()">
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment