调用window.showModalDialog(),不能调用window.location.reload()和提交表单时打开新窗口的解决方案

我们往往会遇到这种情况,就是用 window.showModalDialog弹出的窗口,在里面提交form表单时,或者location.href=""时,都会新弹出窗口,很恶心的。

注:showModalDialog窗口与window.open打开的窗口刷新本窗口时不同,showModalDialo窗口也不能用F5刷新,也没有右 键操作

建议采用以下方式: 



A. 在模式窗口页面中加入:      
<base target="_self"> //在html和body之间
<a id="reload" href="本页面url" style="display:none"></a>

B. 在需要执行刷新操作的地方执行以下js:
reload.click();//reload为A中隐藏a标签的id,当然可以换成其它名称
原文地址:https://www.cnblogs.com/nxblog/p/4569246.html