javascript - decodeURI not fully working -


i'm trying remove uri encoding link, decodeuri doesn't seem working.

my example link this: /linkout?remoteurl=http%253a%252f%252fsandbox.yoyogames.com%252fgames%252f171985-h-a-m-heroic-armies-marching

after running javascript script, looks this:

http%3a%2f%2fsandbox.yoyogames.com%2fgames%2f171985-h-a-m-heroic-armies-marching 

how can rid of remaining not correct codes in uri?

my decoding code:

var href = $(this).attr('href');            // href var href = decodeuri(href.substring(19));   // remove outgoing part , remove escaping $(this).attr('href', 'http://'+href)        // change link on page 

the url looks encoded twice, suggest use decodeuricomponent

decodeuricomponent(decodeuricomponent("http%253a%252f%252fsandbox.yoyogames.com%252fgames%252f171985-h-a-m-heroic-armies-marching")) 

results in: "http://sandbox.yoyogames.com/games/171985-h-a-m-heroic-armies-marching"

but should check why have url encoded twice in advance


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -