Please download the latest version of this plugin.
Ok, I haven’t tested this one a whole lot, so if you find any bugs, please use the comment box below!
Basically, I wrote this as an alternative to using the outdated target="_blank"
in a link’s attributes. Using a tiny bit of javascript and the rel=”external” attribute, it’s a (hopefully) more XHTML compliant option.
This plugin allows you to mark any (or all) of your Blogroll links as ‘external’ and implements a small bit of javascript to open links in new windows. With this plugin enabled, you can also add the rel=”external” tag to any links in your post (or anywhere else in your blog) to have them open in new windows (or tabs depending on the user’s browser settings).
Requires
WordPress version 2.2 or higher — may work with previous versions, I hadn’t tested!
Instructions
- Upload the blank-target-replace folder to WordPress plugins directory and activate on the Plugins page in WP-Admin
- Go to Blogroll > External Links
- Choose the links you want to open in a new window, or tick the top checkbox in the gray bar to check all links as external. Click the “Mark Links External” button at the very bottom of the page.
- That’s it! To do the same for links in your blog entries, simply add rel=”external” to the ‘href’ statement for each link.
Download
Click here to download the zip file.
Caveats / Issues
I did this pretty much on the fly. If you have any Blogroll links that have other rel attributes assigned (i.e. me, neighbor, met, etc. – any of the options under Link Relationship/XFN), you may experience problems getting the link(s) to open in a new window. Best thing is to clear out any existing XFN attributes for each link.
Same thing goes for links in posts that use lightshow or another setting for the rel attribute. It may or may not work.
I have not found a graceful work-around for these yet.
Disclaimer
Use at your own risk. No warranty expressed or implied is provided. There is no guarantee that this will work for your version of WordPress, I wrote this out of need for myself and am sharing in the hopes someone else finds it useful.
Copyright / Permission
This plugin is released under the Creative Commons Attribution-Noncommercial-Share Alike license. Have fun!
Jeff Vreeland
Great Plugin!! I just got it installed on my blog.
It does not seem to open a new window/tab in Firefox.
Is it Firefox compatible?
Jeff Vreeland’s last blog post: Digging a New Artist
Nicki
Hi Jeff,
All of your “Blogs & Reads” opened in new tabs in Firefox and new windows in IE 6 and 7 for me. Are you restricting or blocking javascript by any chance?
Jeff Vreeland
Yeah its doing it for me now as well.
I did a hard refresh on my blog ( + F5) and it got it working.
Sorry for the incorrect bug report :oops:
Jeff Vreeland’s last blog post: Digging a New Artist
Nicki
No problemo, Jeff. Glad it started behaving for you. :mrgreen:
Beth
Yay! It’s a PITA changing all the targets one by one, especially if you’ve imported an OPML file to links!
Beth’s last blog post: [Sticky post] Get a Seat on the Straight Talk Express