Skip to content

Instantly share code, notes, and snippets.



Last active Dec 19, 2015
What would you like to do?
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*='""'])");
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