flash service

High_Performance_Web_Sites

Issue link: https://read.uberflip.com/i/1146286

Contents of this Issue

Navigation

Page 104 of 169

Alternatives to Redirects | 83 requests an image, where the image URL contains the information being tracked (i.e., the link that was clicked): Performance - Wikipedia Be warned: beacons have a number of nuances that make reliable implementation challenging. The challenge in this situation is the race condition between sending the beacon while the page itself is being unloaded. The image beacon's onload handler can be used to ensure the beacon has been delivered before unloading the document: Performance - Wikipedia This approach is likely to be as slow as using a redirect because both techniques require an additional HTTP request. Another approach is to use XMLHttpRequest to send the beacon, but to only wait until the request reaches readyState 2 (sent) before unloading the page. This is faster than waiting for the entire HTTP response of a redi- rect, but you'll have to decide whether the complexity is justified. For more informa- tion about using XMLHttpRequest, visit http://www.w3.org/TR/XMLHttpRequest. A code sample is too complex to show here, but you can see one in the "XMLHttp- Request Beacon" example. There is also an example of the more typical image beacon. XMLHttpRequest Beacon http://stevesouders.com/hpws/xhr-beacon.php Image Beacon http://stevesouders.com/hpws/redir-beacon.php

Articles in this issue

Links on this page

Archives of this issue

view archives of flash service - High_Performance_Web_Sites