扫描二维码下载沐宇APP

沐宇

微信扫码使用沐宇小程序

沐宇

location对象的属性有哪些

扬州沐宇科技
2023-09-14 19:40:25
location

location对象有以下属性:

  • location.href: 返回或设置当前页面的URL

  • location.protocol: 返回或设置当前页面的协议(http、https等)

  • location.host: 返回或设置当前页面的主机名和端口号

  • location.hostname: 返回或设置当前页面的主机名

  • location.port: 返回或设置当前页面的端口号

  • location.pathname: 返回或设置当前页面的路径部分

  • location.search: 返回或设置当前页面的查询字符串部分

  • location.hash: 返回或设置当前页面的URL中的锚点部分

扫码添加客服微信