Formats a string using URL encoding. This is a static method.
urlEncode( text )
The input string to be formatted.
This method will format a string using URL encoding. The formatted string is returned from this method and the original string is not modified. This method is useful for encoding strings that contain any URL reserved characters so they can be used as part of a URL.
The example below encodes a string that is used as a query string parameter in a URL.
var sUrl = “http://localhost/app?user=” + Server.urlEncode(“john doe”);
The example above produces the following output.
This function is very useful when used in the URL transferring string which including space and special character like &.

David Yin

David is a blogger, geek, and web developer — founder of If you like his post, you can say thank you here

Leave a Reply

Your email address will not be published. Required fields are marked *