How to check window.showModalDialog availability?

1.7k views Asked by At

Javascript method window.showModalDialog is deprecated and not working in Chrome browser anymore. Soon it will stop working in Fire Fox. I want to replace it with window.open however only if browser do not support showModalDialog.

How to detect if browser still support this functionality? Is it possible to do by modernizr library and how?

1

There are 1 answers

1
Sterling Archer On BEST ANSWER

Use a condition.

if(window.showModalDialog) console.log("derp");
else console.log("herp");