星空网 > 软件开发 > Java

JS Encode and Decode URL

1.Encode URL String

var url = $(location).attr('href'); //get current url//ORvar url = 'folder/index.html?param=#23dd&noob=yes'; //or specify onevar encodedUrl = encodeURIComponent(url);console.log(encodedUrl);//outputs folder%2Findex.html%3Fparam%3D%2323dd%26noob%3Dyes

2.Decode URL String

var url = $(location).attr('href'); //get current url//ORvar url = 'folder%2Findex.html%3Fparam%3D%2323dd%26noob%3Dyes'; //or specify onevar decodedUrl = decodeURIComponent(url);console.log(decodedUrl);//outputs folder/index.html?param=#23dd&noob=yes

3.HTML URL Endoding References  

space 	%20! 	%21" 	%22# 	%23$ 	%24% 	%25& 	%26' 	%27( 	%28) 	%29* 	%2A+ 	%2B, 	%2C- 	%2D. 	%2E/ 	%2F... etc

测试网址:http://www.w3schools.com/tags/ref_urlencode.asp

原文网址:http://www.sitepoint.com/jquery-decode-url-string/




原标题:JS Encode and Decode URL

关键词:JS

JS
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

海外仓哪些:https://www.goluckyvip.com/tag/33077.html
海外仓那个好:https://www.goluckyvip.com/tag/33078.html
海外仓宁波:https://www.goluckyvip.com/tag/33079.html
外贸价格:https://www.goluckyvip.com/tag/3308.html
海外仓欧洲:https://www.goluckyvip.com/tag/33080.html
海外仓欧洲站:https://www.goluckyvip.com/tag/33081.html
深圳有没有比较好玩的景点 深圳有没有比较好玩的景点推荐一下:https://www.vstour.cn/a/366175.html
长治婚庆女司仪和主持人:https://www.vstour.cn/a/366176.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流