[thelist] target="_blank"

rudy r937 at interlog.com
Sat Aug 18 22:43:02 CDT 2001


>... I wonder about just using another term that isn't one of the
>  "reserved" terms, such as target="new_window"

hi shirley

i think it's the target attribute itself that's invalid in xhtml strict

> Have you hopped over to the W3 specifications about this?

yeah, but i get lost easy

here's how i solved the problem

   <a href="foo.htm"
      onclick="window.open(foo.htm); return false;">foo</a>

neat, eh?  if javascript is enabled, the page opens in a second window, but
if it isn't, the page just opens in the same window

but  <sigh />  there was an added complication

the page i was opening up in the second window was actually just one of a
set of pages, all linked together, with no way to get back to the page that
originally launched the second window

well hey, that's not a problem if it really *is* a second window -- just
close the second window, and the page that launched it is still sitting
there

which is why i started out wanting to use target="_blank"

but the more i thought about it, the less i liked it -- the target
attribute seems to be intended for targetting a frame, and what if the
browser doesn't support frames?  it's the same headache for me as when
javascript is disabled, but at least i gots <noscript> to help out!

if javascript is not enabled, the onclick won't work, but the link itself
will, and you find yourself "going" to the first of the set of linked
pages, and after clicking around in them for a while, getting back to the
page that launched them is hopeless -- the history stack is filled up

so what i did, i snuck a link into each of the linked pages that works like
this --

   <a href="/index.cfm"
      onclick="self.close(); return false;">back</a>

that isn't *exactly* the same, because with javascript disabled, you will
end up going back to whatever page you hardcode in there

and of course if javascript is enabled, it just closes the second window

and now i can make use of  document.write  and a <noscript> block
to give tailored instructions to the page visitor depending on whether
javascript is enabled or not

pretty neat, eh?

and ya know what?  my page validates xhtml strict again   ;o)

feel free to check it out, it's aunt netty on my home page at rudy.ca


rudy













More information about the thelist mailing list