url翻译

 用该属性获取页面 URL 地址:
window.location 对象所包含的属性
属性 描述
hash 从井号 (#) 开始的 URL(锚)
host 主机名和当前 URL 的端口号
hostname 当前 URL 的主机名
href 完整的 URL
pathname 当前 URL 的路径部分
port 当前 URL 的端口号
protocol 当前 URL 的协议
search 从问号 (?) 开始的 URL(查询部分) 
 
//            将文字编码
            var str = encodeURI("文字");
            console.log(str)
//            将文字解码
            var strs = decodeURI(str);
            console.log(strs)
            
//            将文字编码
            var str = encodeURIComponent("文字");
            console.log(str)
//            将文字解码
            var strs = decodeURIComponent(str);
            console.log(strs)
            
原文地址:https://www.cnblogs.com/chaojimali/p/7850264.html