window. open Quick Solution to Blocking Open Window
- 2021-07-09 06:38:49
- OfStack
I encountered several situations in which opening a new window with window. open was blocked (chrome browser used, other browsers were not tested):
The first time: window. open (www. ofstack. com), a new window is opened, but the page is not loaded, and you need to enter to come out
Solution: The page address needs to be added with the protocol name http://or https://
Second time: window. open method is used in the callback function of ajax asynchronous request success. Although the protocol name is added, it does not open a new window and displays the words blocked directly in the address bar
There are two solutions:
1. Change ajax asynchronous request to synchronous request
2. Use var newWindow = window. open ("_ blank"); newWindow. location = "url address";