Skip to content

Instantly share code, notes, and snippets.

@mcrider
Created November 2, 2013 02:59
Show Gist options
  • Save mcrider/7274955 to your computer and use it in GitHub Desktop.
Save mcrider/7274955 to your computer and use it in GitHub Desktop.
location hacking
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