Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Window.showModalDialog Replacement

My project was totally involved in asp.net, We are working on browser compatibility issues,

window.showModalDialog is not working in chrome please help me with any replacement, other than window.open

like image 805
Kar Reddy Avatar asked Jun 27 '26 05:06

Kar Reddy


2 Answers

You could use polyfills to resolve this issue. Click here for more details

Another link that could help

like image 151
Denzil Soans Avatar answered Jun 28 '26 18:06

Denzil Soans


Hi if your concern is that u can edit the parent window even after opening the popup(Which was not the case with showModalDialog), then u can use code something like this using window.open()

<html>
<head>
<script type="text/javascript">

var popupWindow=null;

function child_open()
{ 
if(popupWindow && !popupWindow.closed)
  popupWindow.focus();
else
  popupWindow =window.open('(Any html file)',"_blank","directories=no, status=no, menubar=no, scrollbars=yes, resizable=no,width=600, height=280,top=200,left=200");

}
function parent_disable() {
 if(popupWindow && !popupWindow.closed)
   popupWindow.focus();
}
</script>
</head>
<body onFocus="parent_disable();" onclick="parent_disable();">
  <a href="javascript:child_open()">Click me</a>
</body>    
</html>
like image 40
Sachin J Avatar answered Jun 28 '26 17:06

Sachin J



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!