The Google showModalDialog of method is not compatible with the solution where a dialog window appears

  • 2020-12-18 01:45:47
  • OfStack

showModalDialog, in the test, IE, Firefox in the normal operation, but in google, click after no reaction, on the Internet to see 1, Google Browser does not support showModalDialog modal dialog box and cannot return returnValue, got a solution


<script type="text/javascript">
// Open mode window 
function showMyModal() {
var url = "SelectUser.aspx";
// Example of passing in parameters 
var modalReturnValue = myShowModalDialog(url, window, 300, 500);
//alert(modalReturnValue.name);
// Perform some methods after the window is closed 
//TODO sth
}
// pop-up google Chrome Execution is open
function myShowModalDialog(url, args, width, height) {
var tempReturnValue;
if (navigator.userAgent.indexOf("Chrome") > 0) {
var paramsChrome = 'height=' + height + ', width=' + width + ', top=' + (((window.screen.height - height) / 2) - 50) +
',left=' + ((window.screen.width - width) / 2) + ',toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no';
window.open(url, "newwindow", paramsChrome);
}
else {
var params = 'dialogWidth:' + width + 'px;dialogHeight:' + height + 'px;status:no;dialogLeft:'
+ ((window.screen.width - width) / 2) + 'px;dialogTop:' + (((window.screen.height - height) / 2) - 50) + 'px;';
tempReturnValue = window.showModalDialog(url, args, params);
}
return tempReturnValue;
}
</script> 

Finally, if you want to click, the dialog box will appear. All you need to do is call the method using the onclick event

Above introduced Google showModalDialog() method is not compatible with the problem of dialog window analysis and solutions, hope to help you.


Related articles: