当前位置:网站首页>BOM in JS
BOM in JS
2022-06-28 16:53:00 【Antenna frame】
We are JavaScript In this blog JavaScript There are three parts :
ECMAScript standard ( Basic grammar )
DOM:Document Object Model Document object model , Manipulating page elements
BOM:Browser Object Model Browser object model , Operating the browser
BOM It's the browser object model
BOM It provides some object interfaces that interact with browser windows independently of content pages
BOM The core is window object , therefore window Generally, it can be omitted in writing .
BOM In fact, it is also composed of a series of related objects , And each object provides a lot of methods and properties
BOM Top level objects in
window Object is the top-level object of the browser , Have a dual role
window The object is JS An interface for accessing browser windows
window Object is a global object , All global variables declared , Global method functions end up being window Property or method of the object
other window Method
window object effect
window.open() Open a new window
window.close() Close the current window
window.moveTo() Move the current window
window.resizeTo() Adjust the size of the current window
JavaScript Window Screen
Screen object effect
screen.availWidth Available screen width
screen.availHeight Available screen height
JavaScript Window Location
Location object effect
location.href Return to... On the current page URL
location.hostname return web Domain name of the host
location.pathname Returns the path and filename of the current page
location.port return web Host port (80 or 443)
location.protocol Return to used web agreement (http:// or https://)
location.hash Return fragment ,URL in # Later
location.search Returns the parameter ,URL Parameters refer to URL After the URL in the address ? Later parameters
location.assign() and href equally , You can jump to the page , Redirect jump
location.replace() Replace the current page , Not recorded in history , So you can't go back to the page
location.reload() Reload the page , Equivalent to the refresh button , If the parameter is true It is equivalent to forced refresh
JavaScript Window History
window Object provides a for browsers history Object to interact with the browser's history , In order to protect the privacy of users , Yes JavaScript Access to the object is restricted .
History object effect
history.back() Same as clicking the back button in the browser
history.forward() It's the same as clicking the button in the browser to move forward
history.go( Parameters ) Forward and backward function , If the parameter is 1 Go to a page , If it is -1 Back one page , If it is N Forward or backward N A page
JavaScript Window Navigator
Navigator Object is mainly used to record information about the browser .
Navigator object effect
window.navigator.userAgent adopt userAgent You can determine the type of user's browser
window.navigator.platform adopt platform You can judge the system platform type of the browser
边栏推荐
猜你喜欢

Slim gain (sgain) introduction and code implementation -- missing data filling based on generated countermeasure network

知乎热问:一个程序员的水平能差到什么程度?
![[tcapulusdb knowledge base] tcapulusdb technical support introduction](/img/ae/9295c8ae642cde632d06966c28d342.png)
[tcapulusdb knowledge base] tcapulusdb technical support introduction

【Golang】安装 iris 的方法
![[golang] how to install iris](/img/c6/842c4e920a74f9a07c2f6a82bb0cc1.png)
[golang] how to install iris

Lucky draw animation - Carp jumps over the dragon's gate

General solution of island problems and DFS framework

Briefly introduce the conversion between tensorflow and pytorch (mainly tensorflow to pytorch)

PotPlayer播放百度云盘视频

Flex布局
随机推荐
Gartner announces five privacy trends from today to 2024
使用Karmada实现Helm应用的跨集群部署
抓取手机端变体组合思路设想
General solution of island problems and DFS framework
如何清除 WordPress 中的缓存
使用 Open Connector 进行 HubSpot 和 SAP 系统的集成工作
2019 CSP J2入门组 CSP-S2提高组 第2轮 视频与题解
[golang] how to install iris
中能融合携手天翼云打造“能源大脑”
Have you ever encountered the error that the main key of this setting is consistent with the database?
Solve the problem that subcomponents will not be destroyed through setTimeout
Batchnorm2d principle, function and explanation of batchnorm2d function parameters in pytorch
Flex布局
这个简单的小功能,半年为我们产研团队省下213个小时
运维-- 统一网关非常必要
中国SSD行业企业势力全景图
你好,现在网上炒股开户买股票安全吗?
Noip1998-2018 csp-s2 2019 2021 improvement group problem solving report and video
小新黑苹果声卡ID注入
2019 CSP J2 entry group csp-s2 improvement group round 2 video and question solution