Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save theseanl/be75e32ed7fae085ad6fb7f8c21f1ba0 to your computer and use it in GitHub Desktop.
Save theseanl/be75e32ed7fae085ad6fb7f8c21f1ba0 to your computer and use it in GitHub Desktop.
Browsers built-on popup blocker test

Browsers built-in popup blocker test

Case 1

document.onclick = () => { setTimeout(() => { open('about:blank') , 1000}) }
Browser result
Chrome X
Firefox X
Edge X
IE O

Case 2

document.onclick = () => { setTimeout(() => { setTimeout(() => {open('about:blank');}) }) }
Browser result
Chrome O
Firefox O
Edge X
IE O

Case 3

document.onclick = () => { postMessage("popup", "*") };
addEventListener("message", (evt) => { if (evt.data === "popup") { open('about:blank'); } });
Browser result
Chrome X
Firefox O
Edge X
IE O

Case 4

var eventTarget = document.createElement('div');
eventTarget.addEventListener("customEvent", () => { open('about:blank'); });
document.onclick = () => { eventTarget.dispatchEvent(new CustomEvent('customEvent')) };
Browser result
Chrome X
Firefox X
Edge X
IE X
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment