Skip to content

Instantly share code, notes, and snippets.

@lazamar
Created October 5, 2015 20:45
Show Gist options
  • Save lazamar/adb3c338f3222466b594 to your computer and use it in GitHub Desktop.
Save lazamar/adb3c338f3222466b594 to your computer and use it in GitHub Desktop.
Make all links of an Electron project open in the OS Browser instead of the project's window.
// Little function to make all links of a page in an Electron project
// open in the OS Browser instead of the Project's window.
linksArray = document.getElementsByTagName("a");
for (var i = 0; i < linksArray.length; i++) {
linksArray[i].setAttribute("onclick","app.openInBrowser('" + linksArray[i].href + "')");
linksArray[i].href = "#";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment