I am currently working on an Enquiry system for our travel website.
When a user submits an enquiry, i have set it to reload the same page (by grabbing the current url and setting it as the redirect).
Upon redirecting my javascript detects if the following string is present in the URL – “?sendto”, and if so it returns a thank you message.
After this process, im looking to remove the “?sendto=email@address.com” string from the end of the url (example url – http://www.google.com/index.html?sendto=email@address.com). My question is therefore:
Am i able to through a script, strip a part of the current URL
If you’re asking whether you can change the displayed URL in the browser bar, the answer is no. The reason? Would you want some random site to be able to change their URL to
http://bankofamerica.com?If you’re asking how you can strip it off conveniently for the user (and are ok with a redirect), do something like this:
which will change a url like
to
but it will do it by redirecting the user’s browser to the new url.