From 79ccb5ac88a88d06713e8fe293e99d4f67e4a6d8 Mon Sep 17 00:00:00 2001 From: pacien Date: Sat, 21 Jul 2018 17:01:32 +0200 Subject: Add preemptive popup check --- pointless/viewer/init.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'pointless/viewer') diff --git a/pointless/viewer/init.js b/pointless/viewer/init.js index a9294ea..cb01fab 100644 --- a/pointless/viewer/init.js +++ b/pointless/viewer/init.js @@ -28,8 +28,19 @@ function initCache() { offlineCapableIndicator.style.visibility = "visible"; } +function checkPopupPermission() { + try { + const popup = window.open(); + popup.close(); + } catch(error) { + const warningMessage = document.getElementById("warning"); + warningMessage.textContent = "A pop-up blocker is active. Make sure to allow pop-ups on this website."; + } +} + function init() { initCache(); + checkPopupPermission(); const viewer = new Viewer(); -- cgit v1.2.3