Created
March 25, 2010 14:24
-
-
Save jney/343604 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*** | |
* How to use it in your html page : | |
* copy the code and paste it in your page and update param passed to | |
* Figaro.redirectUrl to desired page. So, Figaro.redirectUrl will | |
* return new calculated URL. | |
* | |
* - Calculated link to pass through | |
* <a href="#" onclick="window.location.replace(Figaro.redirect)"> | |
* Pass this ad | |
* </a> | |
* | |
* - Automatically redirected after 4 seconds | |
* <script> | |
* setTimeout(function(){ | |
* window.location.replace(Figaro.redirectUrl); | |
* },4000); | |
* </script> | |
* | |
***/ | |
if(typeof window.Figaro == "undefined") | |
Figaro = {} | |
Figaro.redirectUrl = (function(url){ | |
var xtref = encodeURIComponent(document.referrer), | |
xtor = document.location.search.match(/[?|&]xtor=([^&]+)/) || | |
document.location.hash.match(/^#xtor=(.+)$/) || ""; | |
if (xtor != "") xtor = "&xtor=" + xtor[1]; | |
return xtref ? (url + "?xtref=" + xtref + xtor) : url; | |
})("http://www.lefigaro.fr/") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment