Home > Web Front-end > JS Tutorial > What is the use of javascript bom?

What is the use of javascript bom?

藏色散人
Release: 2023-01-06 11:12:17
Original
2541 people have browsed it

The functions of javascript bom: 1. Pop up a new browser window; 2. Move, close and change the size of the browser window; 3. Navigation objects that can provide detailed information about the web browser; 4. Can provide browser A local object that loads page details; 5. A screen object that can provide detailed information about the user's screen resolution, etc.

What is the use of javascript bom?

The operating environment of this article: windows7 system, javascript version 1.8.5, Dell G3 computer.

Detailed explanation of the main functions of BOM in JavaScript

Mainly introduce the browser object model (BOM)

If you understand DOM, BOM understanding It’s much easier to get up.

If you don’t understand anything, I’ll explain the difference. Pay attention and listen to what’s being tested in the exam! ! !

Document Object Model treats "document" as an "object".

Browser Object Model (browser object model) treats "browser" as an "object".

Main functions of BOM

  • Pop up a new browser window

  • Move, close and change Browser window size

  • Navigation object that provides details about the web browser

  • Local object that provides details about the page the browser loads

  • Screen object that provides details about the user's screen resolution

  • Supports Cookies

  • Internet The Explorer browser extends the BOM, and the ActiveX object

BOM includes five types of objects. Let’s take a look at them in detail first

1. window object

2. history object

3. location object

4. scren object

5. navigator object

Let’s talk about the first window object first Commonly used methods

promep() method displays a dialog box that prompts the user for input

alert() method displays a prompt message and an alert box for the OK button

confirm() method Display a confirmation box with prompt message OK and Cancel button

close() method closes the browser window

open() method opens a new browser window

setTimeout () method calls the function to calculate the expression after the set milliseconds

setInterval() method according to the set period (in milliseconds)

clearInterval() cancels repeated settings, the same as setInterval( )corresponds to

The second type of history object

The history object can jump the current browser page to the page that Mog once opened

The third type of location object

The location object is used to manage the URL information of the currently opened exposure, which is equivalent to the browser's address bar.

The fourth type of screen object

The window.screen object contains information related to the user screen. You do not need to use the window prefix when writing

The fifth type of navigator object

The navigator object contains browser-related information.

For example:

navigation.appCodeName returns the code name of the browser

navigation.appName returns the name of the browser

navigation.cpuClass returns the browser system CPU level

and so on. . . . .

Recommended study: "javascript Advanced Tutorial"

The above is the detailed content of What is the use of javascript bom?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template