I believe that friends who have used window.open have encountered situations where the page cannot pop up by being intercepted by the browser; let’s change our thinking, under what circumstances will the new page pop up not be intercepted by the browser? For example, the <a /> tag will not be the case; then we just need to simulate the user and actively click on the <a /> tag, there will be no interception problem.
Define the HTML tag first:
The code copy is as follows:
<a href="" id="alink" target="_blank" style="display: none"><span id="spanlink">test</span></a>
<input type="button" value="Click me to pop up a new page" onclick="targetClick()" />
Then assign a value to the <a /> tag in JS and trigger a click event:
The code copy is as follows:
function targetClick() {
$("#alink").attr("href", "http://www.163.com");
$("#spanlink").click();
return false;
}
OK, the pop-up of the page will be unblocked.