<!DOCTYPE html> <!-- target: hello.txt --> <!-- Some pages (*cough* Reddit *cough*) insert a target=_blank *after* a link was clicked, which is early enough for the browser to try and open a new tab, but too late for hints to notice. This means the page won't be opened at all when javascript-can-open-windows is false. --> <html> <head> <meta charset="utf-8"> <title>Link where we insert target=_blank via JS</title> <script type="text/javascript"> function setup_event_listener() { var elem = document.getElementById('link'); elem.addEventListener('click', function() { elem.target = '_blank'; }); } </script> </head> <body onload="setup_event_listener()"> <a href="/data/hello.txt" id="link">Follow me!</a> </body> </html>