解决方法:
$(function(){
if(window.showModalDialog == undefined){
window.showModalDialog = function(url,mixedVar,features){
window.hasOpenWindow = true;
if(mixedVar) var mixedVar = mixedVar;
if(features) var features = features.replace(/(dialog)|(px)/ig,"").replace(/;/g,',').replace(/\:/g,"=");
window.myNewWindow = window.open(url,"_blank",features);
}
}
}); 由于谷歌、火狐没有内置在这个方法,所以在调用showModalDialog的时候 先判断是否是undefined。
如果是,那就定义一下这个方法。
本文介绍了一种兼容谷歌和火狐浏览器的方法,通过检测是否存在showModalDialog方法来确定是否需要手动定义该方法。这对于需要在不同浏览器间保持一致弹窗对话体验的网页应用尤其有用。
498

被折叠的 条评论
为什么被折叠?



