操作BOM对象 1. 浏览器介绍 JavaScript和浏览器的关系 JavaScript的诞生就是为了能够让他能够在浏览器中运行 BOM:浏览器对象模型 IE 6~11 Chrome Safari
操作BOM对象
- IE 6~11
- Chrome
- Safari
- Firefox
- Opera
window.alert(1)
undefined
window.innerHeight
448
window.innerWidth
1920
window.outerHeight
1040
window.outerWidth
1920
navigator.appVersion
"5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML,like Gecko) Chrome/74.0.3729.169 Safari/537.36"
navigator.userAgent
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML,like Gecko) Chrome/74.0.3729.169 Safari/537.36"
navigator.platform
"Win32"
navigator.appName
"Netscape"
screen.width
1920
screen.height
1080
host: "www.baidu.com"
href: "https://www.baidu.com/?tn=02003390_43_hao_pg"
protocol: "https:"
reload: ƒ reload() //刷新网页
//设置新的地址
location.assign('https://home.cnblogs.com/blog/')
document.title
"百度一下,你就知道"
document.title = "宏颜获水" //改变当前页面的title
"宏颜获水"
<dl id="app">
<dt>Java</dt>
<dd>JavaSE</dd>
<dd>JavaEE</dd>
</dl>
<script>
var dl = document.getElementById('app');
</script>
document.cookie
<script src = "aa.js"></script>
<!--恶意人员:获取你的cookie上传到他的服务器-->
//页面的后退和前进
history.back()
history.forward()