In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces how to intercept open in window, which has certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article. Let's take a look at it with you.
In the security mechanism of Chrome, window.open methods that are not directly triggered by users are blocked. This is because browsers forbid the direct use of window.open (url) to open new links in js in order to maintain user security and experience (window.open (url, "_ self") changes the current window can take effect).
The solution to the interception of windowopen
1. The way the form is submitted
Varform=document.createElement ('form')
Form.action='www.baidu.com?id=1'
Form.target='_blank'
Form.method='POST'
Document.body.appendChild (form)
Form.submit ()
In this way, if you need to pass parameters, you need to use the POST method, and the default GET method cannot pass parameters. That is, there are no parameters in the url of the new page.
In addition, Ajax uses form forms to simulate downloads when downloading files.
two。 Put the open window action directly in the button / link onclick event
3. Delay this open operation
SetTimeout ('window.open (url);', 500); / / delay time cannot be too short, otherwise it will also be intercepted.
Windowopen is intercepted and changed mode.
Open a new window through js will be blocked, another way of implementation
Vartempwindow=window.open ('_ blank'); / / Open the page first
Change the page address after temp_window.location=' http://www.baidu.com';//
Thank you for reading this article carefully. I hope the article "what to do if open is blocked in window" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.