Hi, I have a CRED form that changes the current user on submit.
Ajax is off and it refreshes the page on submit.
Problem is that it adds some query string to the URL, and I'd like to get rid of that.
`webtemple.io/?_tt=1566115370&_success=285_1&_target=1#cred_form_285_1`
Status messages are not important for my application here.
How can I accomplish that?
Thank you
Hi, Forms requires those URL parameters in certain circumstances so there are no options available for suppressing them. If you'd like to remove them completely, you would have to implement custom JavaScript to manipulate the URL hash after the page loads. Here's a Stack Overflow post with a couple of examples: https://stackoverflow.com/questions/22753052/remove-url-parameters-without-refreshing-page
Thank you!
That is exactly what I was looking for!
I will just add the code from the page here, so others can find it easier:
1- To modify current URL and add / inject it (the new modified URL) as a new URL entry to history list, use pushState:
window.history.pushState({}, document.title, "/" + "my-new-url.html");
2- To replace current URL without adding it to history entries, use replaceState:
window.history.replaceState({}, document.title, "/" + "my-new-url.html");
via https://stackoverflow.com/questions/22753052/remove-url-parameters-without-refreshing-page