JavaScript(BOM对象的操作)

BOM:浏览器对象模型

window

全局对象

window.alert(1);//弹窗警告
//获取浏览器窗口内外部边框数据
window.innerHeight;
window.innerWidth;
window.outerHeight
window.outerWidth;

Navigator

当前浏览器对象

navigator.appName//获取当前应用名
navigator.appVersion//获取浏览器版本信息

大多数时候,我们不会使用navigator对象,因为会被人为修改

screen

获取全屏幕属性

screen.width
screen.height

location

代表当前页面的URL信息

host: "editor.csdn.net"//主机
hostname: "editor.csdn.net"
protocol: "https:"//协议
href: "https://editor.csdn.net/"//指向
reload: ƒ reload()//刷新网页
\\设置新的地址
location.assign('https://blog.csdn.net/fhuqw?spm=1000.2115.3001.5343');

history

前进后退

histroy.back()
history.forward()

Supongo que te gusta

Origin blog.csdn.net/fhuqw/article/details/121120979
Recomendado
Clasificación