Open External Links in New Window
Shows how to automatically open all external links in a new window
Since version 2, Plone has the new function scanforlinks() which scans the div with id="content" for external links. This function inserts a span tag with the CSS class
link-external around the link's a tag, which causes a world-icon to be displayed before the link. The function can also set the target attribute of the a tag to open the link in a new window, but this behaviour is disabled by default. To enable it, you can customize the javascript.
In Plone 2.0.5 this function can be found in plone_javascript.js. With the introduction of the Resource Registry in the Plone 2.1.x series, Plone's javascript has been split into multiple smaller files. As a result of this, this function can now be found in mark_special_links.js.
- Depending on your Plone version, use the ZMI to go to either
portal_skins/plone_ecmascript/plone_javascripts.js(2.0.5) orportal_skins/plone_ecmascript/mark_special_links.js(2.1.2), select one of your skin folders (e.g. custom) andCustomizeit. - Switch to the skin folder where the copy of plone_javascripts.js lies and uncomment the following line:
//links![i].setAttribute('target','_blank')
Change it to:
links![i].setAttribute('target','_blank')
...and it will open all external links in separate windows. Useful for intranet use cases, but please don't use this approach on public web sites.

why?
why would you not do this on a public site? I for one HATE that when I leave the site I am visiting when I am doing research. Having the portal open a new window is, in my opinion, a better approach.
Is there a reason other than personal preference to not enable this on a public portal?