[UPHPU] xhtml strict and open in new window

Jonathan Duncan jonathan at jkdwebmagic.com
Wed May 10 21:45:46 MDT 2006


On Wed, 10 May 2006, Mac Newbold wrote:

> Today at 4:58pm, Tyler Gee said:
> 
>>> Does this:
>>>
>>>   <a href="http://test.com/" onclick="window.open(this.href); return
>>> false;">Link Text</a>
>>> 
>>> keep the current window where it is (in my case, mscis.org), but open a
>>> new window that goes to test.com?
> 
> Yes, it should keep the current window where it is.
>

Yes it does.  The "return false" keeps it that way like Mac pointed out. I 
found this method because I needed it on many of the sites that we do for 
customers.  Many other methods, like you have seen, cause the parent page to 
refresh or change the url or not show any status or other things. This is a 
method that I started using after many trials and errors with other methods. 
It works best for my purposes and those of my clients.  It is really simple, 
"compliant", and lite.


> Actually, in my experience, that's exactly what it does. If you have a tag 
> (<a>, <input>, etc.) with an onclick event, and that onclick event returns 
> false, the other processing of it is stopped. So an <a> tag with an href and 
> an onclick that ends in return false, the href won't be followed in the 
> current window like normal. I've never had problems with it in MSIE, Firefox, 
> or Safari.
>

Jonathan


More information about the UPHPU mailing list