From c76619549afc86fc8912451113347f9e7153c8d1 Mon Sep 17 00:00:00 2001 From: pacien Date: Sat, 21 Jul 2018 19:51:27 +0200 Subject: Use self-closing page for popup check --- appcache.js | 1 + pointless/viewer/init.js | 7 +++---- popup.html | 17 +++++++++++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 popup.html diff --git a/appcache.js b/appcache.js index d51f775..d8c8187 100644 --- a/appcache.js +++ b/appcache.js @@ -13,6 +13,7 @@ class AppCache { this.cacheName = "cache"; this.filesToCache = [ ".", + "popup.html", "appcache.js", "favicon.ico", diff --git a/pointless/viewer/init.js b/pointless/viewer/init.js index cb01fab..5f04eac 100644 --- a/pointless/viewer/init.js +++ b/pointless/viewer/init.js @@ -29,10 +29,9 @@ function initCache() { } function checkPopupPermission() { - try { - const popup = window.open(); - popup.close(); - } catch(error) { + const popup = window.open("popup.html"); + + if (popup == null) { const warningMessage = document.getElementById("warning"); warningMessage.textContent = "A pop-up blocker is active. Make sure to allow pop-ups on this website."; } diff --git a/popup.html b/popup.html new file mode 100644 index 0000000..f08241b --- /dev/null +++ b/popup.html @@ -0,0 +1,17 @@ + + + + + + + + + + + + -- cgit v1.2.3