参考:url的三个js编码函数escape(),encodeURI(),encodeURIComponent()简介
使用encodeURI()对url进行编码,用decodeURI()解码。
test
解码前:
alert(window.location.href);

解码后:
alert(decodeURI(window.location.href));

博客介绍了URL的三个JS编码函数escape()、encodeURI()、encodeURIComponent(),着重提及使用encodeURI()对URL进行编码,用decodeURI()进行解码,并给出了解码前后的情况。
参考:url的三个js编码函数escape(),encodeURI(),encodeURIComponent()简介
使用encodeURI()对url进行编码,用decodeURI()解码。
解码前:
alert(window.location.href);

解码后:
alert(decodeURI(window.location.href));


被折叠的 条评论
为什么被折叠?