假设有
A.html , B.html
A.html使用js的window.showModalDialog('B.html');
B.html的js里面使用跳转location.href = "http://www.baidu.com";
firefox、chrom 会在弹出框内跳转,IE 会弹出新窗口去显示href的连接
解决方法有两种..
1. location.href = "http://www.baidu.com"; 换成
- window.name = "__self";
- window.open("http://www.baidu.com" , "__self");
2.新建一个页面C.html加入iframe连接B.html,那么就可以随意使用跳转
A.html js部分类容:
- function openWindow(url){
- window.showModalDialog(url, null , "dialogWidth=800px;dialogHeight=504px;scroll=0");
- location.reload();
- }
C.html内容:
- <body style="width:800px; height:500px;padding:0px ; margin:0px;" >
- <iframe frameborder="0" style="width:800px; height:500px" src="b.html">
- </iframe>
- </body>