Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I decode a URL with jQuery?

Tags:

jquery

How can I decode a URL using jQuery? My url is

http%3A%2F%2Fdtzhqpwfdzscm.cloudfront.net%2F4ca06373624db.jpg

like image 207
XMen Avatar asked Sep 27 '10 12:09

XMen


People also ask

Does browser automatically decode URL?

kinda de-facto standard yes. but only in modern browsers. its done for user convienience, so you can put utf8 charactesr in an url and its still pretty to the human eye. however please be aware that the text is actually still encoded and will be transmittet/requested encoded, it is only displayed decoded.

How do I use encodeURIComponent in JavaScript?

The encodeURIComponent() function encodes a URI by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character (will only be four escape sequences for characters composed of two "surrogate" characters).


1 Answers

Try the decodeURIComponent function:

var decodedUri = decodeURIComponent('http%3A%2F%2Fdtzhqpwfdzscm.cloudfront.net%2F4ca06373624db.jpg'); alert(decodedUri); 
like image 154
Darin Dimitrov Avatar answered Nov 10 '22 18:11

Darin Dimitrov