Home > Web Front-end > JS Tutorial > Custom prompt effect code after window.open is intercepted by the browser_javascript skills

Custom prompt effect code after window.open is intercepted by the browser_javascript skills

WBOY
Release: 2016-05-16 19:08:00
Original
979 people have browsed it

More and more browsers now have the function of blocking pop-up windows. It doesn't matter if the ads pop up and are blocked. But if the customer blocks them when paying, it doesn't matter.

Gmail’s “Oops” is a classic, but the day before yesterday, Xinyun gave a more cool tip=. = Remember to test it after turning on browser interception. I don’t know if the code will be filtered in the online reader. . The code is below, it actually has no technical content. Dig haha. . .

Copy code The code is as follows:

window._open=window.open;
window.open=function(sURL,sName,sFeatures,bReplace){
if(sName==undefined){sName="_blank"};
if(sFeatures==undefined){sFeatures="" };
if(bReplace==undefined){bReplace=false};
var win=window._open(sURL,sName,sFeatures,bReplace);
if(!win){
alert ('Oh my god! There is software on your machine to block pop-up windows. It's so annoying. They won't come anymore! Get rid of it~~555~');
return false;
}
return true;
}

=. = After two days of rewriting window.open, I still couldn’t think of a better way. The parameters need to be added one by one. The fourth parameter seems to be just to avoid being back, for example:
Copy code The code is as follows:


window.open("a.html","a");
window. open("b.html","a","",true);
There is no back button when opening b.html. MSDN has instructions.

Optional. Boolean that specifies whether the sURL creates a new entry or replaces the current entry in the window's history list. This parameter only takes effect if the sURL is loaded into the same window.

true sURL replaces the current document in the history list
false sURL creates a new entry in the history list.
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template