Skip to content

Instantly share code, notes, and snippets.

@murgatroydj
Last active March 19, 2021 16:11
Show Gist options
  • Save murgatroydj/7654015 to your computer and use it in GitHub Desktop.
Save murgatroydj/7654015 to your computer and use it in GitHub Desktop.
Jquery snippet to add target="_blank" to all external links in a documen and force PDFs to open in a new window/tab as well.Replace mydomainname with yours to skip internal links.
@maxlipsky
Copy link

Hello! Thanks for gist. A small correction: mydomainname must be in quotes, like:
not('a[href*="mydomainname"]')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment