window.open () is a bullet window ads, but because the browser's interception mechanism is more and more perfect, open the chance of getting lower.
Before in Baidu saw many kinds of writing, such as:
To trigger the Click event of a button through JS
To trigger a form's submit event through JS, and the form's target is set to _blank
But after my tests, the findings are no longer compatible.
So I thought of the following approach:
<script>
var new_window = null;
Add a confirmation that you can perform many of your own judgments
in this method ... function Sure_open () {
if (confirm) (' OK to open PHP enthusiasts. ")
Open_window (URL);
else
new_window.close ();//Close window
}
function Open_window (URL) {
new_window.location.href = URL;
}
</script>
<input type= "button" onclick= "New_window = window.open (); Open_window (' http:// www.phplover.cn ') ' value= "open php enthusiasts"/>
The principle used is that
Trigger window.open () to open a new window (because it is the real user behavior, the browser will think the user will, will not intercept)
And then through JS to change the new window location
Come on, give it a try.