As the question states, how do you hide/unhide/mask URL query parameters in javascript? This site appears to be able to do something like it:
.js/#!
(Check the "Share it! If checked, the option values will be stored in the URL so that you can easily share your settings.")
Say I have the following URL...
http://localhost/?var1=value1&var2=value2&var3=value3
How do I hide just the var2 and var3 portion such that the URL is:
http://localhost/?var1=value1
(WIth a click of a link on the page to toggle the GET variable in and out of the page without refreshing it.)
As the question states, how do you hide/unhide/mask URL query parameters in javascript? This site appears to be able to do something like it:
http://bernii.github.io/gauge.js/#!
(Check the "Share it! If checked, the option values will be stored in the URL so that you can easily share your settings.")
Say I have the following URL...
http://localhost/?var1=value1&var2=value2&var3=value3
How do I hide just the var2 and var3 portion such that the URL is:
http://localhost/?var1=value1
(WIth a click of a link on the page to toggle the GET variable in and out of the page without refreshing it.)
Share Improve this question edited Jun 19, 2013 at 2:08 Rolando asked Jun 19, 2013 at 1:59 RolandoRolando 62.7k104 gold badges279 silver badges422 bronze badges 3- I care about hiding/masking the GET parameters with a click of a link, not retrieving them. – Rolando Commented Jun 19, 2013 at 2:14
- If you don't want the users know the parameters ,right? How about encode the parameters,using base64 or some other methods to encode them. – teemo Commented Jun 19, 2013 at 2:26
- I just want the user to be able to hide and unhide params without refreshing the page like the site I linked to depicts. I could care less about parameter encodings unless that is somehow part of the method used by the website I linked to show and hide parameters in the URL with the click of the share checkbox. – Rolando Commented Jun 19, 2013 at 2:36
2 Answers
Reset to default 6Try replaceState
:
if(history.replaceState) history.replaceState({}, "", "/");
Where / is the path you want to show.
Create a hidden form with a POST method, fill the two params to <input type="hidden">
and submit. All with JS.