Reputation: 3538
I have this url that im trying to decode
var a = 'https%3A%2F%2Fwww.gem.com%2Fextension%3Furl%3D'
var b = decodeURI(a)
console.log(b)
"https%3A%2F%2Fwww.gem.com%2Fextension%3Furl%3D"
What am I doing wrong?
Upvotes: 3
Views: 257
Reputation: 42044
You need to use decodeURIComponent():
var a = 'https%3A%2F%2Fwww.gem.com%2Fextension%3Furl%3D';
var b = decodeURIComponent(a);
console.log(b);
Upvotes: 5