Writeups

When sending a print post message twice to the PDF viewer API it would force the user to switch to that tab.

let f = document.createElement('iframe');
f.hidden = true;
f.src =
  'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf';
document.body.appendChild(f);
setTimeout((_) => {
  f.contentWindow[0].postMessage({type: 'print'}, '*');
  f.contentWindow[0].postMessage({type: 'print'}, '*');
  setTimeout(location.reload(), 100);
}, 100);

This issue was fixed in https://issues.chromium.org/40828189 video PoC https://www.youtube.com/watch?v=n28qodJ4hhk