Basic JavaScript Question:
What are decodeURI() and encodeURI() functions in JavaScript?
Answer:
Many characters cannot be sent in a URL, but must be converted to their hex encoding. These functions are used to convert an entire URI (a superset of URL) to and from a format that can be sent via a URI.
<script type="text/javascript">
var uri = "http://www.google.com/search?q=Online Web Tutorials at GlobalGuideLine"
document.write("Original uri: "+uri);
document.write("<br />encoded: "+encodeURI(uri));
</script>
<script type="text/javascript">
var uri = "http://www.google.com/search?q=Online Web Tutorials at GlobalGuideLine"
document.write("Original uri: "+uri);
document.write("<br />encoded: "+encodeURI(uri));
</script>
Previous Question | Next Question |
What's Prototypes for JavaScript? | What is bind in javascript? |