Window. open is a js command to open a new window. It is often used to open a window. However, many browsers have used Windows. open is blocked. Next I will introduce the solution to window. the method of blocking open.
First look at a common window. open window instance
The Code is as follows: |
Copy code |
<SCRIPT> <! -- Window. open ('page.html ', 'newwindow', 'height = 100, width = 400, top = 0, left = 0, toolbar = no, menubar = no, scrollbars = no, resizable = no, location = no, status = no ') // Write a row --> </SCRIPT>
|
After running the script, page.html will be opened in the newwindow of the new form, with a width of 100 and a height of 400. It is 0 pixels away from the screen top, 0 pixels left, no tool bar, no menu bar, no scroll bar, and cannot be adjusted, no address bar, no status bar, but the result cannot be opened. This check later found that the browser provided a window. open, and then find a piece of code to solve the problem.
View Code directly
The Code is as follows: |
Copy code |
<! Doctype html public "-// W3C // dtd html 4.01 Transitional // EN" "http://www.w3.org/TR/html4/loose.dtd">
<Html>
<Head>
<Title> </title>
<Script type = "text/javascript" src = "http://code.jquery.com/jquery-1.4.1.min.js"> </script>
<Script type = "text/javascript">
<! --
$ (
Function ()
{
// Method 1
Window. showModalDialog ("http://www.bKjia. c0m /");
Window. showModalDialog ("http://www.bKjia. c0m /");
// Method 2
Var aa = window. open ();
SetTimeout (function (){
Aa. location = "http://www.bKjia. c0m ";
},100 );
Var B = window. open ();
SetTimeout (function (){
B. location = "http://www.bKjia. c0m ";
},200 );
Var c = window. open ();
SetTimeout (function (){
C. location = "http://www.bKjia. c0m ";
},300 );
Var d = window. open ();
SetTimeout (function (){
D. location = "http://www.bKjia. c0m ";
},400 );
Var ee = window. open ();
SetTimeout (function (){
Ee. location = "http://www.bKjia. c0m ";
},500 );
Var f = window. open ();
SetTimeout (function (){
F. location = "http://www.bKjia. c0m ";
},600 );
Var g = window. open ();
SetTimeout (function (){
G. location = "http://www.bKjia. c0m ";
},700 );
Var h = window. open ();
SetTimeout (function (){
H. location = "http://www.bKjia. c0m ";
},800 );
Var I = window. open ();
SetTimeout (function (){
I. location = "http://www.bKjia. c0m ";
},900 );
Var j = window. open ();
SetTimeout (function (){
J. location = "http://www.bKjia. c0m ";
},1000 );
// Method 3
Var a = $ ("<a href = 'HTTP: // www. bKjia. c0m'target = '_ blank'> Apple </a> "). get (0 );
Var e = document. createEvent ('mouseevents ');
E. initEvent ('click', true, true );
A. dispatchEvent (e );
Var a = $ ("<a href = 'HTTP: // www. bKjia. c0m'target = '_ blank'> Apple </a> "). get (0 );
Var e = document. createEvent ('mouseevents ');
E. initEvent ('click', true, true );
A. dispatchEvent (e );
}
);
// -->
</Script>
</Head>
<Body> </body>
</Html> |