Links which open in a new window

Many internet users and webmasters (often beginners) appear to think that some certain links on websites should forcibly open a new window in the browser. The SPIP team, like many others, think that this is bad practice.

-  In cases where this is absolutely necessary, you should enter the link in full HTML, by hand, without employing an SPIP short-cut. To force the link to open in a new window, just add the HTML target attribute with the value _blank, as illustrated here: <a href="page.html" target="_blank">Title of the link</a>.

-  However, in an effort to help the lives of webmasters who absolutely do want this functionality, there is a filter called |liens_ouvrants (to be used in the templates) which will "override" the behaviour of external links that use SPIP short-cuts, like [titre->].

Historical note: During the development of SPIP, some time around September 2002, we tried out the idea of a supplementary link short-cut, an idea we abandoned after considerable clam reflection: and one which we will not return to again ;-)

Other alternative methods to be avoided are listed here, with explanations why:

  1. A hack of the SPIP short-cuts, something along the lines of [text->URL" target=..."] is often suggested in the SPIP forums as a "solution". Where as this is the worst* of all solutions. In fact, if the day later arrives when we want to do something else with the links (perhaps, for example, include the links in a table and check them periodically), then anyone who has used this kind of "hard code" hack will have some real problems.
  2. The link [text->>link], which was tested between 21/09 and 13/12 2002, in the development versions, was not satisfactory. It introduced too many checking problems for webmasters that didn’t want it that way.

The correct solution, let us repeat it here, is to not use links that open in new windows; the other possibility, less better, is to systematically use them by employing the |liens_ouvrants filter in the appropriate template file.

Author Mark Published : Updated : 26/10/12

Translations : català, corsu, English, Español, français, italiano, Nederlands, òc lengadocian, Português do Brasil, slovenčina