高版本Chrome不支持showModalDialog

高版本Chrome不支持window.showModalDialog,可用window.open代替

 1 var url = "https://www.baidu.com";
 2 var args = {};
 3 var swidth = 830;
 4 var sheight = 600;
 5 var sLeft = (window.screen.width - 830) / 2;
 6 var sTop = (window.screen.height - 600) / 2;
 7 
 8 window.showModalDialog(url, args, "dialogWidth=" + swidth + "px;dialogHeight=" + sheight + "px;status=no;help=no;scroll=yes;resizable=yes;minimize=yes;maximize=yes;");
 9 
10 window.open(url, '打开百度', 'top=' + sTop + ',left=' + sLeft + ',height=' + sheight + ', width=' + swidth + ', toolbar=no, menubar=no, resizable=yes,location=no, status=no');

 

posted @ 2016-12-28 16:55  wuln  阅读(172)  评论(0编辑  收藏  举报