Open External Links in 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.

