Skip to content

Instantly share code, notes, and snippets.

@cgack
Created January 14, 2013 14:44
Show Gist options
  • Save cgack/4530524 to your computer and use it in GitHub Desktop.
Save cgack/4530524 to your computer and use it in GitHub Desktop.
onClick
/* turn all target = _blanks into whitelisted urls */
$(document).on("click", function (event) {
if (event.target.target === "_blank" && event.target.href.indexOf("#openExternal=true") === -1) {
event.target.href = event.target.href + "#openExternal=true";
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment