diff --git a/lib/shareon.js b/lib/shareon.js index 3a5d4e3..e81643d 100644 --- a/lib/shareon.js +++ b/lib/shareon.js @@ -103,11 +103,9 @@ const shareon = () => { child.setAttribute('rel', 'noopener noreferrer'); child.setAttribute('target', '_blank'); } else { - const getButtonListener = (buttonUrl) => () => { - window.open(buttonUrl, '_blank', 'noopener,noreferrer'); + child.onclick = () => { + window.open(url, '_blank', 'noopener,noreferrer'); }; - - child.addEventListener('click', getButtonListener(url)); } break; // once a network is detected we don't want to check further