javascript location 对象

location对象属性图示

 

location属性

  • hash 属性 -- 返回URL中#符号后面的内容
  • host 属性 -- 返回域名
  • hostname 属性 -- 返回主域名
  • href 属性 -- 返回当前文档的完整URL或设置当前文档的URL
  • pathname 属性 -- 返回URL中域名后的部分
  • port 属性 -- 返回URL中的端口
  • protocol 属性 -- 返回URL中的协议
  • search 属性 -- 返回URL中的查询字符串
  • assign() 函数 -- 设置当前文档的URL
  • replace() 函数 -- 设置当前文档的URL,并在history对象的地址列表中删除这个URL
  • reload() 函数 -- 重新载入当前文档(从server服务器端)
  • toString() 函数 -- 返回location对象href属性当前的值

    参考:http://www.dreamdu.com/javascript/
原文地址:https://www.cnblogs.com/qwj888/p/1987715.html