Chrome不支持showModalDialog模态对话框和无法返回returnValue的问题

父窗体部分js代码:

1 var returnValue = window.showModalDialog("son.html ", window);
2 //for chrome
3 if (returnValue == undefined) {
4     returnValue = window.returnValue;
5 }

子窗体部分js代码:

if (window.opener != undefined) {
       //for chrome
       window.opener.returnValue = "opener returnValue";
}
else {
       window.returnValue = "window returnValue";
}
window.close();

这样也在IE,FireFox,Chrome,Safari等浏览器下都可以通用了。 

原文地址:https://www.cnblogs.com/sgciviolence/p/4480521.html