From b21015c377fc2a575df49b6800919e623ada45b3 Mon Sep 17 00:00:00 2001 From: Jaifroid Date: Thu, 1 Jun 2023 15:01:40 +0100 Subject: [PATCH] Don't fail if browser blocks window opening --- www/js/app.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/www/js/app.js b/www/js/app.js index aa3e8eb9..14db2e4c 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -5406,8 +5406,11 @@ function addListenersToLink(a, href, baseUrl) { articleContainer = window.open('article.html', params.windowOpener === 'tab' ? '_blank' : a.title, params.windowOpener === 'window' ? 'toolbar=0,location=0,menubar=0,width=800,height=600,resizable=1,scrollbars=1' : null); appstate.target = 'window'; - articleContainer.kiwixType = appstate.target; - articleWindow = articleContainer; + // We have to make this conditional, because sometimes this action is blocked by the browser + if (articleContainer) { + articleContainer.kiwixType = appstate.target; + articleWindow = articleContainer; + } } } e.preventDefault();