Skip to content

Instantly share code, notes, and snippets.

@hhsnopek
Last active August 29, 2015 14:22
Show Gist options
  • Save hhsnopek/9067bbe94ba029c58e96 to your computer and use it in GitHub Desktop.
Save hhsnopek/9067bbe94ba029c58e96 to your computer and use it in GitHub Desktop.
encode url parameters from obj
var newUrl = "http://localhost:1111/?",
objKeys = [];
objKeys = Object.keys(obj);
for (var u = 0; u < objKeys.length; u++) {
var key = objKeys[u];
newUrl += key + "=" + escape(obj[key]) + "&";
}
history.pushState('', 'Title Goes Here', newUrl);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment