What is decodeURI(), encodeURI() in JavaScript?

What is decodeURI(), encodeURI() in JavaScript?

To send the characters that can not be specified in a URL should be converted into their equivalent hex encoding. To perform this task the methods encodeURI() and decodeURI() are used.

For example, the following code snippet performs the encoding of URL:
<script type="text/javascript">
    var uri = http://www.mysite.com/city?=Banglore; // original URI
    var ncodeuri=encodeURI(uri);
    document.write("<br />ncodeuri”);
    var dcodeuri = decodeURI(ncodeuri);
    document.write(“<br/>dcodeuri”);
</script>

What is decodeURI(), encodeURI() in JavaScript?

These functions are used to encode and decode the URIs.

Example
String: Career Ride

Operation: encodeURI()
Output: Career%20Ride

Operation: decodeURI()
Output: Career Ride
Methods GET vs. POST in HTML forms
Encoding form data into URL is needed by the GET method. The form data is to be appeared within the message body...
What does the EnableViewStateMac setting in an aspx page do?
What does the EnableViewStateMac setting in an aspx page do? - ...
JavaScript - What are windows object and navigator object in JavaScript?
What are windows object and navigator object in JavaScript? - ....
Post your comment