Created
November 2, 2013 02:59
-
-
Save mcrider/7274955 to your computer and use it in GitHub Desktop.
location hacking
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
function getURLParameter(name) { | |
return decodeURI( | |
(RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1] | |
); | |
} | |
document.ready( | |
// assuming url like: foo.html?name="123" | |
var params = getURLParameter('name'); // returns 123 | |
tracker.head = params.charAt(0); | |
tracker.body = params.charAt(1); | |
tracker.legs = params.charAt(2); | |
// set slider positions or position images | |
// build url from tracker | |
var url = 'foo.html?=' + tracker.head + tracker.body; | |
// redirect to that url | |
window.location(url); | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment