Url参数是另一段带参Url

Js的话,主要就是encodeURIComponent的使用,他会把路径中的符号、中文进行编码,这样不会与Url中的语法设定冲突

例:

console.log('http://accounts.wondershare.com/v3/user/oauth-client/authorize?app_key=b6e1266bb5e2dc6fd40a83317837ad2f&redirect_uri=' + encodeURIComponent('http://localhost:8080?redirect=http://a.com') + '&scope=user&product_id=7942&response_type=code');

 

你可能感兴趣的:(javascript)