开发者

Site redirect: research and question on Facebook's way

I have developed a site that has urls to other sites. I would like to make it redirect but log the click on the redi开发者_如何学Pythonrection.

I tried to find the way facebook does this, just to learn and came with this code:

<html>
<body>
    <script type="text/javascript">
        /* <![CDATA[ */
        document.location.replace($url);
        /* ]]> */
    </script>
    <script type="text/javascript">
        /* <![CDATA[ */
        setTimeout("(new Image()).src='/laudit.php?r=JS&u%5Bprotocol%5D=http&u%5Bdomain%5D=www.youtube.com&u%5Bport%5D&u%5Bpath%5D=%2Fwatch&u%5Bquery%5D%5Bv%5D=uZ2sPofyjXc&u%5BrawQueryString%5D=v%3DuZ2sPofyjXc';",5000);
        /* ]]> */</script>
</body>

My question is: what is the purpose to put a url inside an image source and inside a timeout? I guess it's to call an audit page, using timeout to simulate a kind of async call to the page, and create a "ficticious" image, just to call the URL?


Encountered this one too, and got curious.

I believe they are just tracking the pages which loads slow or doesn't redirect correctly

if it takes more than 5 secs (5000) the laudit.php will execute, then they track it and do some back-end stuffs.

But if the javascript redirect script works within the time, the laudit tracker won't execute.

Maybe facebook is doing some more checks later on about the site, probably just some analytics or for performance purpose

I think laudit means link audit

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜