Removing unused query parameters from the URL
I have a web form with several fields. When the user submits the form, they usually only enter data into one of the fields. I wanted the resulting GET url to only include the field(s) they entered any information into. Here's the code I came up with:
This appears to work on at least the following browsers:
- Firefox 1.0.6
- IE 6.00
- Opera 8.0
If anyone has a better solution, either client-side, or server-side, I would love to hear it.