Skip to content

Instantly share code, notes, and snippets.

@scripting
Last active September 6, 2017 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scripting/b7234a0840112217c0945cd92acf8acd to your computer and use it in GitHub Desktop.
Save scripting/b7234a0840112217c0945cd92acf8acd to your computer and use it in GitHub Desktop.
Code that's part of "Instant Dave" that makes links open in an external window
//see blog post here -- http://scripting.com/2017/09/06.html#a094746
function openLinksInExternalWindow () {
$(document).off ("click", 'a[href^="http"]'); //remove pre-existing click handlers
$(document).on ("click", 'a[href^="http"]', function (event) {
event.preventDefault ();
electron.shell.openExternal (this.href);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment