Last active
September 6, 2017 13:58
-
-
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
This file contains hidden or 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
//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