Hi,
I'm using the GET parameters in the URL of a landing page. Then using these passed values in my landers to display relevant information.
This is working great until I noticed that any parameter that has a space in the string e.g. "Kuala Lumpur" is being shown with the space character like this = "Kulala%20Lumpur".
My question is, how do make sure that a space is displayed rather than the character?
I had a google around and couldn't find the solution.
Thanks in advance,
Gav
The %20 characters are only displayed in the URL. when you retrieved them it will be automatically transformed into spaces
This is called URL encoding.
What code do you use to display the values on your lander?
Should be shown correctly when it´s decoded before it´s displayed.
Ok, I thought it should decode the %20 into a space character.
But on one of my landers a city is displayed as "Kuala%20Lumpur". And it surprised me.
It's a ripped lander, the GET function was already there but I think I inserted the innerText code to grab the city.
// GET URL function function getURLParameter(name) { return decodeURI( (RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1] || '' ); } document.getElementById('city').innerText = getURLParameter('city');