[ar] [ast] [bg] [br] [ca] [co] [cpf] [cs] [da] [de] [en] [eo] [es] [eu] [fa] [fon] [fr] [gl] [id] [it] [ja] [lb] [nl] [oc] [pl] [pt] [ro] [ru] [sk] [sv] [tr] [uk] [vi] [zh] Espace de traduction

Home > English documentation > Using SPIP > Editor’s user guide > Links which open in a new window

Links which open in a new window

June 2010

All the versions of this article:

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->http://www.uzine.net/spip].

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.

Show the template of this page Site powered by SPIP | Translation area | Private area