Last active
December 19, 2015 04:29
-
-
Save louisstow/5897420 to your computer and use it in GitHub Desktop.
Force external links to open in a new browser window on Firefox OS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (navigator.mozApps && window.locationbar.visible === false) { | |
var externalLinks = document.querySelectorAll("a[href^='http']:not([href*='"+location.host+"'])"); | |
for (var i = 0; i < externalLinks.length; ++i) { | |
externalLinks[i].setAttribute("target", "_blank"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment