0

I have an image URL that has been encoded to escape the slashes.

https:\\/\\/s3-eu-west-1.amazonaws.com\\/adido-toolbank\\/Thumbnails\\/F\\/FLV26461.JPG

How do I go about decoding this URL in jquery? decodeURI and decodeURIComponent are not working.

1 Answers1

1

You can use split() and join(). Do this:

var url = "https:\\/\\/s3-eu-west-1.amazonaws.com\\/adido-toolbank\\/Thumbnails\\/F\\/FLV26461.JPG";

console.log( url.split( String.fromCharCode(92) ).join('') );
Kavian K.
  • 1,340
  • 1
  • 9
  • 11