4 ms·
<dialog> <p>Hello world</p> <button>OK</button> </dialog> <script> let dialog = document.querySelector('dialog'); dialo
by dchest 8y ago
<dialog>
<p>Hello world</p>
<button>OK</button>
</dialog>
<script>
let dialog = document.querySelector('dialog');
dialog.querySelector('button').addEventListener('click', () => dialog.close());
dialog.showModal();
</script>
- deleted 8y ago[deleted]
- yoavm 8y agoYeah, it would be great when it'll work for more than just 60% of the internet users. Maybe then we can actually use it!
- dchest 8y agoI'm so sorry that a little bit of HTML and JavaScript reminds you and other commenters under my post of web developer's Old Browser nightmares and brave endeavors of satisfying 100% of Web users at any the cost, but we're talking about Electron which ships a quite recent version of Chromium :-)
- deleted 8y ago[deleted]
- _ZeD_ 8y agocool... then now make it work for ie. and mobiles. and... everything else other than the betas of chrome and firefox
- thiht 8y agohere you go: https://github.com/GoogleChrome/dialog-polyfill https://github.com/GoogleChrome/dialog-polyfill
- singularity2001 8y agoTypeError: dialog.showModal is not a function
- dchest 8y agoYour Electron version is old; if you're shipping it, you're probably putting your users at risk due to security issues in them. Check the latest versions here: https://electronjs.org/releases https://electronjs.org/releases
- singularity2001 8y agohttps://caniuse.com/#search=dialog https://caniuse.com/#search=dialog ? NO! <script> confirm("No dialog needed") </script>
- dchest 8y agoNice table, which shows that you are free to use <dialog> and many other modern features to write your Electron app: Electron v2.0.2 Chromium v61.0.3163.100 Node v8.9.3v8 v6.1.534.41
- singularity2001 8y agoElectron… fair point! Except we were comparing new web GUIs. On the flip side Electron explicitly does not impliment confirm() and prompt() which made me furious. So there is definitely truth in the general js=cluster-fuck sentiment.
- hajile 8y ago`confirm()`, `alert()`, `prompt()` and similar are widely regarded as mistakes. Including them on your new Electron app isn't something you should be doing in the first place.
- dchest 8y agoIndeed: https://developers.google.com/web/updates/2017/03/dialogs-policy https://developers.google.com/web/updates/2017/03/dialogs-po... Electron has native dialog APIs: https://electronjs.org/docs/api/dialog https://electronjs.org/docs/api/dialog