How can I decode a URL using jQuery? My url is
http%3A%2F%2Fdtzhqpwfdzscm.cloudfront.net%2F4ca06373624db.jpg
How can I decode a URL using jQuery? My url is
http%3A%2F%2Fdtzhqpwfdzscm.cloudfront.net%2F4ca06373624db.jpg
Try the decodeURIComponent function:
var decodedUri = decodeURIComponent('http%3A%2F%2Fdtzhqpwfdzscm.cloudfront.net%2F4ca06373624db.jpg');
alert(decodedUri);
decodeURIComponent('http%3A%2F%2Fdtzhqpwfdzscm.cloudfront.net%2F4ca06373624db.jpg')
Use decodeURIComponent(), for example:
decodeURIComponent("http%3A%2F%2Fdtzhqpwfdzscm.cloudfront.net%2F4ca06373624db.jpg")
It's not jQuery specific, this is a base JavaScript function.
Hi,
You can simply call the standard javascript functions for encoding and decoding respectively.
encodeURIComponent
decodeURIComponent
Enjoy!