现在越来越多的浏览器有拦截弹出窗口的功能。广告弹出来给拦掉了就无所谓,要是客户在付款时给拦掉了可就不能乱算了。
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};
varwin=window._open(sURL,sName,sFeatures,bReplace);
if(!win){
alert('天啦!你的机器上竟然有软件拦截弹出窗口耶,好讨厌哦,人家不来了啦!快去掉嘛~~555~');
returnfalse;
}
returntrue;
}
=。=重写window.open写了两天都没有想到更好的办法,参数要一个一个加,第四个参数,似乎只是为了不被back回去,例如:
复制代码 代码如下:
window.open("a.html","a");
window.open("b.html","a","",true);
打开的b.html是没有后退可以按滴,MSDN有说明。
Optional.BooleanthatspecifieswhetherthesURLcreatesanewentryorreplacesthecurrententryinthewindow'shistorylist.ThisparameteronlytakeseffectifthesURLisloadedintothesamewindow.
truesURLreplacesthecurrentdocumentinthehistorylist
falsesURLcreatesanewentryinthehistorylist.