From fb4a0651f9694f41f3fe6821ed128d4d596d13d5 Mon Sep 17 00:00:00 2001 From: Nikita Karamov Date: Fri, 18 Sep 2020 20:24:22 +0200 Subject: [PATCH] Fix button listeners --- src/shareon.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/shareon.js b/src/shareon.js index 9446f3b..35b0864 100644 --- a/src/shareon.js +++ b/src/shareon.js @@ -57,9 +57,11 @@ const initializeShareon = () => { child.setAttribute('rel', 'noopener noreferrer'); child.setAttribute('target', '_blank'); } else { - child.addEventListener('click', () => { - window.open(url, '_blank', 'noopener,noreferrer').opener = null; - }); + const getButtonListener = (buttonUrl) => () => { + window.open(buttonUrl, '_blank', 'noopener,noreferrer'); + }; + + child.addEventListener('click', getButtonListener(url)); } break; // once a network is detected we don't want to check further