Opening New Windows

When using strict doctypes the target attribute is not allowed for opening new windows. This script will accomplish that task easily and unobtrusively.

The script uses the class name "non-html" so you will need to add that to the links you want to open in a new window, e.g., <a href="yourDocument.html" class="non-html">A sample file</a>

This script will not open a new window if a modifier key (ctrl/shift/etc.) is pressed while the link is clicked.

It also checks if the new window was successfully opened. If it was not, it returns true to allow the browser to open the link in the original window.


Source
View
Rating
Size of active file
Submitted day

Roger Johansson
74
- 0 vote
5.34 KBytes
30/12/2007

Some similar scripts

+ Open New Window Dropdown []