Open Comment Author Links in New Window
Question
After I upgraded to 3.2, the comment author links no longer open in a new window. How can I get this behavior back?
Answer
Consider This First
In version 3.2, we took deliberate steps to move away from spawning new windows, because it's becoming increasingly frowned upon by Internet users who want to choose for themselves whether or not to launch a new browser window. Most modern browsers provide an easy way for a user to select a link and have it open in a new window instead of the current one; so take the time to consider whether visitors to your site might be happier if you left that decision up to them.
Pop-Up Comments
If you decide not to force new windows upon your visitors, but are still using pop-up comments, it's possible that your default comment window is too small to be useful for viewing after the visitor clicks a comment author link. So make sure the window is resizable by checking the pop-up Javascript in the HEAD section of your pages:
'width=480,height=480,scrollbars=yes,status=yes,resizable=yes');
Not Convinced?
If you do decide you still want new windows for your comment author links, there are a couple of approaches you can take that won't require modifications to the Movable Type core files.
Use HTML
The easiest solution is to place the following tag before the </head> tag in your template(s):
<base target="_blank">
Then save the changes and rebuild your site.
The downside to this method is that it will cause all links on the resulting pages to open in a new window.
Use a Plugin
If you only want to change the behavior for the comment author links, use the Regex plugin.
- Install the plugin according to the instructions in the README.txt file included in the download.
- In any template where you are displaying comment author links, place the following code before your comments listing (i.e., before
<MTComments>):<MTAddRegex>s|a href|a target=\"_blank\" href|g</MTAddRegex> - Modify your MTCommentAuthorLink tag to use Regex:
<MTCommentAuthorLink default_name="Anonymous" regex="1"> - If you like, you can also use the same method on other link tags, such as MTCommentBody:
<MTCommentBody regex="1"> - Save any template changes.
- Check your Limit HTML Tags settings to make sure they include
a href target, or thetarget="_blank"added by Regex will be stripped from the links. See Allow HTML in Comments for information on how to modify these settings. - Rebuild your site.
- The comment author links should now open in new windows.


