Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
–
Try the
decodeURIComponent
function:
var decodedUri = decodeURIComponent('http%3A%2F%2Fdtzhqpwfdzscm.cloudfront.net%2F4ca06373624db.jpg');
alert(decodedUri);
–
–
–
–
Use decodeURIComponent()
, for example:
decodeURIComponent("http%3A%2F%2Fdtzhqpwfdzscm.cloudfront.net%2F4ca06373624db.jpg")
It's not jQuery specific, this is a base JavaScript function.
You can simply call the standard javascript functions for encoding and decoding respectively.
encodeURIComponent
decodeURIComponent
Enjoy!
If you URL should also contain blanks encoded as '+', the following call will help (taken from https://stackoverflow.com/a/4458580/430742):
decodeURIComponent((str+'').replace(/\+/g, '%20'))
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.