[whatwg] <a href="" ping="">

On Sat, 22 Oct 2005 00:14:46 +0300, Ian Hickson <ian at hixie.ch> wrote:

> On Fri, 21 Oct 2005, Charles Iliya Krempeaux wrote:
<...>
>
> Oh, I know. My salary comes almost entirely from Web advertising. :-)
>
>
<...>
>
> As currently defined the ping="" attribute takes a space-separated list  
> of
> URIs, so this should be already taken care of.
>
>
<...>
>
> You can detect whether the UA supports it or not by putting the attribute
> in uppercase:
>
>    <a href="http://example.com"  
> PING="redirect?uri=http%3A%2F%2Fexample.com">
>
> ...and then in the script checking to see if the ".ping" DOM attribute
> exists or not. If it doesn't, copy the value of PING into href:
>
>    var links = document.getElementsByTagName('a');
>    for (var i = 0; i < links.length; i += 1)
>      if (!links[i].ping && links[i].getAttribute('ping'))
>        links[i].href = links[i].getAttribute('ping');
>
> Run this script once per page and it'll switch you back to using the old
> method of redirects, with the new user agents (that support ping) having  
> a
> better UI. You could also do the same in reverse with slightly more
> complicated JS if you wanted to default to the href="" method for non-JS
> browsers (which would make sense until ping="" support is widespread).
>
> Thanks for your input!

I wouldn't encourage 'ugly' hacks even before finishing the specification  
:).
For this to work people also have to rely on JS.


-- 
http://www.robodesign.ro
ROBO Design - We bring you the future

Received on Saturday, 22 October 2005 02:08:16 UTC