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

Christian Schmidt whatwg.org at chsc.dk
Wed Oct 26 11:14:14 PDT 2005


Ian Hickson skrev:
> On Tue, 25 Oct 2005, Christian Schmidt wrote:
>>One backwards-compatible way (that doesn't require scripting) to solve 
>>this problem would be to add a new attribute that specifies the eventual 
>>target URI:
>>
>><a 
>>href="http://tracker.example.com/?id=1&amp;url=http://dest.example.com/foo.html 
>>target-href="http://dest.example.com/foo.html">
>>
>>[...]
> 
> That's an interesting idea.
> 
> One problem (a blocker problem IMHO) is that it doesn't really allow for 
> moving to a world where, once HTML5 is widely supported, the redirect 
> pages can stop redirecting, and just log and return nothing.
Adding a redirect capeability to a tracking CGI script is extremely
simple (usually one line of code). Considering that tracking scripts are
relatively rare (they are used often, but not many people hack their own
tracking scripts), I don't think it would be a big gain if tracking
scripts wouldn't have to support redirecting.


> It's not as clean as href="" ping="".
Agreed.


>>- The server hosting the tracking CGI script should be alive.
> Again, same with any system.
Not necessarily. With the solution used today, the server hosting the
tracking script must be alive - otherwise the user wont be redirected to
the target URI. Your suggestion allows the UA to go to the target URI
even though the tracking server is down (the ping can be done
asynchronously). It removes a possibly weak link.


Another thing that is nice about your suggestion is that it provides the
UA a way to send data back to the server right before leaving a page.
This can be done today using e.g. XMLHttpRequest, but it often fails if
the UA loads the new page before the XMLHttpRequest succeeds. Perhaps
this feature can be generalized so that it can be used from script to
send arbitrary data back to the server when the page is unloaded, not
only pings triggered by clicks on links.


Christian



More information about the whatwg mailing list