Getting rid of target="_blank"

May 07, 2009 04:58


OK, found a way to keep links from opening new windows in Safari. Here it is:

Step 1: Install GreaseKit. (GreaseKit is the Safari port of Greasemonkey, a Firefox add-on that lets you run arbitrary JavaScript code to modify web pages as they download.)

Step 2: Install _blank Must Die, a userscript that strips the target="_blank" attributes out of link tags.

Step 3: Quit and relaunch Safari.

Step 4: Sigh with relief when Twitter links no longer spawn new windows.

Note for Firefox users: That userscript in Step 2 ought to work for you as well, but you don’t need to bother, since you’ve got some useful features baked right into your browser, no add-ons required.

Microsoft Internet Explorer users, I dunno. If you guys cared about your web experience, you wouldn’t be using MSIE.

Update: Just discovered that the GreaseKit _blank Must Die hack will mess up Google Calendar. The fix is to disable the hack for Google, like so:
  1. In Safari, from the GreaseKit menu, choose “Manage Scripts…”
  2. In the Manage Scripts dialog, select “_blank Must Die” from the list on the left of the box. (Don’t turn the check-box off, just click the name “_blank Must Die” to select it.)
  3. See the “Exclude” box? Click the “Add” button next to it.
  4. In that new line that was just created in the Exclude box, type:
    *.google.com/*
  5. Close the Manage Scripts box. Maybe you need to quit and restart Safari, too.

firefox, mac, computers

Previous post Next post
Up