JWindow Location and Window History and Window Navigator

版权声明:感谢观看我的博客https://me.csdn.net/weixin_43794314 https://blog.csdn.net/weixin_43794314/article/details/86424195

JavaScript Window Location

window.location 对象用于获得当前页面的地址(URL)
并把浏览器重定向到新的页面
window.location 对象在编写时可不使用window前缀
location.hostname 返回web主机的域名
location.pathname 返回当前页面的路径和文件名
location.port 返回web主机的端口 (80443)
location.protocol 返回所使用的web协议(http:// 或 https://)
location.href 属性返回当前页面的URL。
location.assign() 方法加载新的文档。

JavaScript Window History

window.history对象包含浏览器的历史
window.history对象在编写时可不使用window前缀
为了保护用户隐私,对JavaScript访问该对象的方法做出了限制
history.back() 与在浏览器点击后退按钮相同
history.forward() 与在浏览器中点击向前按钮相同

JavaScript Window Navigator

window.navigator对象包含有关访问者浏览器的信息
浏览器代号 navigator.appCodeName 
浏览器名称 navigator.appName
浏览器版本 navigator.appVersion
启用Cookies navigator.cookieEnabled
硬件平台 navigator.platform 
用户代理 navigator.userAgent
用户代理语言 navigator.systemLanguage

猜你喜欢

转载自blog.csdn.net/weixin_43794314/article/details/86424195