[UPHPU] xhtml strict and open in new window

Tyler Gee geekout at gmail.com
Wed May 10 15:43:01 MDT 2006


It is better to use something like the following:

http://www.brucelawson.co.uk/index.php/2005/opening-links-in-new-windows-in-xhtml-strict/

Basically, you use the xhtml strict ref attribute, deliver that to the
browser as xhtml-compliant, and then rewrite the target attribute
(which exists in the DOM but not within the xhtml) to have a value of
"_blank".

Should be more fully compliant than other solutions.

Cheers,
Tyler

On 5/10/06, Brandon Stout <hplsbyufan at imapmail.org> wrote:
> The xhtml strict standard deprecates the "target" attribute for the
> anchor tag (<a>).  The only other way I know of to instruct the browser
> to open a link in another window uses "onclick" javascript events.  I
> have two examples on my site:
>
> http://mscis.org
>
> The phpwebsite logo provides the first example.  The code:
>
>    <img onmouseover="this.style.cursor='pointer'"
>     onclick="window.open('http://phpwebsite.appstate.edu/','_blank');"
>     src="themes/clean/img/logo.gif" alt="phpWebsite" />
>
> I use "onmouseover" so people can tell it's a link.  I avoid using <a
> href="#"> because then the status bar shows the wrong URL - it looks
> like the logo will link back to MSCIS.org.  I also avoid <a
> href="http://phpwebsite.appstate.edu/"> because that would redirect the
> current page and open the link in another window.
>
> The words "Glorianne Muggli" provide the second example (this time, just
> text, and no image).  The code:
>
>    <p>Site Logo &copy; <a onmouseover="this.style.cursor='pointer'"
>     onclick="window.open('http://gloriannemuggli.com/','_blank');">Glorianne
>     Muggli</a>
>
> Again, I avoid the anchor tag's "href" attribute for the same reasons.
>
> The problems:
>
>   1. The status bar now shows nothing.  I'd like it to show where the
> correct URL.
>   2. The text link is not blue, so it's not readily apparent that it's a
> link.  If I make it blue using the "color" attribute, it will not change
> color after clicking the link.
>
> The question:
>
>   How can I resolve these issues, and maintain xhtml strict compliance?
>
> Note that my website currently uses xhtml transitional, however I'm
> going to migrate everything from phpwebsite into my own design, and I
> want xhtml strict for that.
>
> I'm open to javascript, css, xhtml, php, and any other solution
> following my reasoning, or an entirely different method.
>
> Thank you,
>
> Brandon Stout
> http://mscis.org
>
> _______________________________________________
>
> UPHPU mailing list
> UPHPU at uphpu.org
> http://uphpu.org/mailman/listinfo/uphpu
> IRC: #uphpu on irc.freenode.net
>



More information about the UPHPU mailing list