it is recommended not to use cool techs. Since browsers don't want you to do so, it means that cool techs that is successful today may not be available after a while.
simulate a tag click, and the interface gets the address to create a tag to add to the body and use js to click to destroy.
var a=document.createElement('a');
a.href='https://www.baidu.com'//
a.target='_blank';
document.body.appendChild(a)
a.click();
blocking reason: when JS script triggers a link or form submission, it will be blocked by the browser. This is the browser's security defense mechanism. You can also set the browser settings to allow new windows to open unconditionally.
this method will not be blocked: after the API request is successful, you first var openNewWindow = window.open ("", "_ blank"), open an empty new page, and then redirect your url to the new page openNewWindow.location.href = "- sharp-sharp-sharp".
there is another way: change the ajax request to Synchronize, and after the request is returned, use window.open (url)
you can first write a tag on the page, and then dynamically change his url, finally using js to simulate click events, so it's OK. (just tried, it seems to have been intercepted)
did the landlord find the answer? ask for advice. I also want to use JS to automatically click on the hyperlink and open a new window without being blocked.