Objective:
This article is only a few of the records and summaries that have been encountered in your personal work and may be meaningless.
Event review:
In development, PM requires that multiple links be entered in a single page and then opened in a new window with a single click, so the idea is to use window.open to implement it, but the test finds it intercepted.
Analysis:
About window.open user Many predecessors have written related articles, it is not introduced here, see window.open usage
The following tests were done for different browsers
1. The user clicks the event, triggers the opening of a new window
The user clicks the event to trigger a new window for example:
Obj.onclick=function () {
window.open (URL);
}
A new window opens through a user event, which opens a new window that the browser will think is the user's own needs, most browsers will not intercept
Currently testing several user events, only click and Dbclick are not blocked by the browser
Window blocking is not just about the browser kernel, so there are tests on native IE and several common IE kernel browsers.
Event: Click,dbclick
Non-blocking browsers are: Chrome,ff,ie 6.0-10.0,safari,opera,360 browser
Interception: Sogou Browser
Event: Mouseover,mousemove,mouseout,scroll, etc.
No interception: None
Intercept: Chrome,ff,ie 6.0-10.0,safari,opera,360 Browser
2. The user clicks the event, triggers to open several new windows
Click once to successfully open multiple windows in the browser: ff,360 browser, Safari
Click once to open the first window, behind the window blocker browser: Chrome,ie 6.0-10.0,opera
3.Javascript Auto Trigger open window
Such as:
SetTimeout (function () {window.open (' http://www.baidu.com ')},1000)
Or the AJAX request succeeds after the execution
$obj. Click (function () {
$.ajax ({
Sucss:function (data) {
if (data) {
window.open (' http://www.baidu.com ')
}
}
})
})
Blocked browsers: Test several browsers to intercept
Solution:
1. For Ajax after the return to open a new window, you can open a blank window after the user clicks, and then return to the success of the blank window a URL, so that it will not be blocked
$obj. Click (function () {
var newtab=window.open (' About:blank ');
$.ajax ({
Sucss:function (data) {
if (data) {
window.open (' http://www.baidu.com ');
Newtab.location.href= "http://www.baidu.com";
}
}
})
})
2. The script triggers the open new window itself
See online a lot of said new a tag, analog Click, tested, invalid, please Daniel guide
window.open () post-intercept analysis