window.open被瀏覽器攔截后的自定義提示效果代碼
更新時間:2007年11月19日 21:57:35 作者:
現(xiàn)在越來越多的瀏覽器有攔截彈出窗口的功能。廣告彈出來給攔掉了就無所謂,要是客戶在付款時給攔掉了可就不能亂算了。
Gmail的“哎呀”算是經(jīng)典,可是,前天心云給出了更帥的提示=。= 記得打開瀏覽器攔截后 測試一下,在線閱讀器里不知道代碼會不會給過濾。。代碼在下邊,其實沒什么技術(shù)含量滴。挖哈哈。。。
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('天啦!你的機器上竟然有軟件攔截彈出窗口耶,好討厭哦,人家不來了啦!快去掉嘛~~555~');
return false;
}
return true;
}
=。= 重寫window.open寫了兩天都沒有想到更好的辦法,參數(shù)要一個一個加,第四個參數(shù),似乎只是為了不被back回去,例如:
window.open("a.html","a");
window.open("b.html","a","",true);
打開的b.html是沒有后退可以按滴,MSDN有說明 。
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.
Gmail的“哎呀”算是經(jīng)典,可是,前天心云給出了更帥的提示=。= 記得打開瀏覽器攔截后 測試一下,在線閱讀器里不知道代碼會不會給過濾。。代碼在下邊,其實沒什么技術(shù)含量滴。挖哈哈。。。
復(fù)制代碼 代碼如下:
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('天啦!你的機器上竟然有軟件攔截彈出窗口耶,好討厭哦,人家不來了啦!快去掉嘛~~555~');
return false;
}
return true;
}
=。= 重寫window.open寫了兩天都沒有想到更好的辦法,參數(shù)要一個一個加,第四個參數(shù),似乎只是為了不被back回去,例如:
復(fù)制代碼 代碼如下:
window.open("a.html","a");
window.open("b.html","a","",true);
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.
相關(guān)文章
IOS中safari下的select下拉菜單文字過長不換行的解決方法
今天在項目開發(fā)中遇到一個問題safari下的select下拉菜單文字過長不換行問題,最終我用<optgroup>標(biāo)簽解決此問題,下面小編把實現(xiàn)思路分享給大家供大家參考2016-09-09Javascript remove 自定義數(shù)組刪除方法
Javascript自定義數(shù)組刪除方法remove(),需要的朋友可以參考下。2009-10-10淺析script標(biāo)簽中的defer與async屬性
最近在網(wǎng)上看到一個前輩在寫script標(biāo)簽的時候,居然同時寫了async和defer屬性,想著這是什么意思呢?所以決定深入的了解下這其中的學(xué)問,以下這篇文章就是個人在學(xué)習(xí)了之后的一些總結(jié)分析,有需要的朋友們可以參考借鑒,下面來一起學(xué)習(xí)學(xué)習(xí)吧。2016-11-11Extjs4中tree的拖拽功能(可以兩棵樹之間拖拽) 簡單實例
這篇文章主要介紹了Extjs4中tree的拖拽功能簡單實例,有需要的朋友可以參考一下2013-12-12