Friday, December 9, 2011

使用javascript代码来猜测你访问过的站点

声明:山寨的,来自visipisi

The javascript code on this page attempts to guess if you have recently visited a website by loading an image from the target website. If the loading completes fast (less than 10ms), it is highly likely that it was loaded from browser's local cache as the network latency and speed of most Internet connections cannot deliver sub 10ms speed. If it takes longer, it's not in the cache. To avoid polluting the cache, the loading is interrupted at the 10ms mark. This is important because any subsequent tests will yield the same results.

根据你load的这些站点的image的速度来判断是否从本地cache load的,假如很久,就不是从cache来的。

Although the idea is simple, two factors affect the speed and accuracy of the test: the speed at which the browser loads content from its cache, and the realtimeness of the OS and the browser event system to allow interrupting the request at a precise time.

只是把load的时间由10ms改为了50ms(考虑中国国情)

查看这里:http://www.econsh.com/test_what_u_visit.html

No comments:

Post a Comment