Skip to content

Instantly share code, notes, and snippets.

@louisstow
Last active December 19, 2015 04:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save louisstow/5897420 to your computer and use it in GitHub Desktop.
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
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