window.open被瀏覽器攔截后的自定義提示效果代碼
更新時間:2007年11月19日 21:57:35 作者:
現(xiàn)在越來越多的瀏覽器有攔截彈出窗口的功能。廣告彈出來給攔掉了就無所謂,要是客戶在付款時給攔掉了可就不能亂算了。
Gmail的“哎呀”算是經典,可是,前天心云給出了更帥的提示=。= 記得打開瀏覽器攔截后 測試一下,在線閱讀器里不知道代碼會不會給過濾。。代碼在下邊,其實沒什么技術含量滴。挖哈哈。。。
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的“哎呀”算是經典,可是,前天心云給出了更帥的提示=。= 記得打開瀏覽器攔截后 測試一下,在線閱讀器里不知道代碼會不會給過濾。。代碼在下邊,其實沒什么技術含量滴。挖哈哈。。。
復制代碼 代碼如下:
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);
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.
相關文章
Javascript highcharts 餅圖顯示數(shù)量和百分比實例代碼
這篇文章主要介紹了Javascript highcharts 餅圖顯示數(shù)量和百分比實例代碼的相關資料,這里附有實例代碼,需要的朋友可以參考下2016-12-12
JS PHP字符串截取函數(shù)實現(xiàn)原理解析
這篇文章主要介紹了JS PHP字符串截取函數(shù)實現(xiàn)原理解析,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友可以參考下2020-08-08
第一次動手實現(xiàn)bootstrap table分頁效果
這篇文章主要為大家詳細介紹了第一次動手實現(xiàn)bootstrap table分頁效果的相關代碼,具有一定的參考價值,感興趣的小伙伴們可以參考一下2016-09-09
javascript 刪除select中的所有option的實例
這篇文章主要介紹了javascript 刪除select中的所有option的實例的相關資料,希望通過本文能幫助到大家實現(xiàn)這樣的功能,需要的朋友可以參考下2017-09-09
javascript中Date()函數(shù)在各瀏覽器中的顯示效果
本文給大家分享的是javascript中Date()函數(shù)在各瀏覽器中的顯示效果,由于各大瀏覽器的兼容性問題,本文做了這個測試,希望有需要的小伙伴可以少走些彎路2015-06-06
原生JS實現(xiàn)的多個彩色小球跟隨鼠標移動動畫效果示例
這篇文章主要介紹了原生JS實現(xiàn)的多個彩色小球跟隨鼠標移動動畫效果,涉及javascript事件響應、頁面元素屬性動態(tài)修改及隨機數(shù)應用等相關操作技巧,需要的朋友可以參考下2018-02-02

