Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Open external links in a new window when your web app runs in a chromeless runtime. Useful for Firefox OS and iOS web apps! Created and tested in Firefox.
branch: master

Merge pull request #1 from eviljeff/patch-1

added caveats to readme
latest commit 7ae7c731b3
Harald Kirschner authored
Failed to load latest commit information.
LICENSE First version.
README.md added caveats to readme
script.js First version.
script.min.js First version.
test.html First version.

README.md

Open External Links in New Window

JavaScript snippet for Chromeless Apps

Automatically open external links in a new window when your web app runs in a chromeless runtime.

Especially useful for Firefox OS and iOS web apps! Created for Firefox OS apps, works on the whole modern web.

Why it doesn't suck

  • Event delegation: Fast load and works on dynamic content
  • Doesn't use window.open, just changes the target for clicked links
  • Keeps existing target references intact
  • Vanilla JavaScript (i.e. no dependencies), the best cross-browser framework!

Why it's not a 100% solution

  • Can't catch links to pages on the same host that don't have navigation back to your web app
  • If you use multiple hostnames (e.g. login.mywebsite.com and www.mywebsite.com) within your app then those links will be broken.

How to Use

Either or:

  • Copy code into your web app project,
  • Embed deferred via github,
  • … or just get inspired and make your own.
Something went wrong with that request. Please try again.