BOM (Browser object model) browser objects models

Source: Internet
Author: User

The JavaScript implementation is made up of 3 parts: Core (ECMAScript), Document Object Model (DOM), Browser object model (BOM)

BOM (Browser object model) browser objects models
The BOM defines the interface for JavaScript to manipulate the various features of the browser, providing access to various functional parts of the document, such as the window itself, screen features, frames, browsing history, and how to do so.
The BOM is the only part of the JavaScript application that has no relevant standards, and each browser has its own BOM extension implementation.

BOM Object Description
The top-level object in the window's JavaScript hierarchy, which represents the browser window.
Navigator contains information about the client browser.
Screen contains information about the client display.
History contains URLs that have been accessed by the browser window.
Location contains information for the current URL.

Window object; Windows opened in the browser.
If a frame (frame or iframe label) is included, the browser creates a Window object for both the HTML document and an additional window object for each frame.
Frames[] Returns all named frame sets in the window; frames referenced in the frames[] array can include frames, which can have their own frames[] array.

The

Window Object Properties
Property describes whether the
closed return window has been closed. The
Defaultstatus Sets or returns the default text in the window's status bar. The
document read-only reference to the Document object. See Document object. The
History read-only reference to the History object. Please use the parameter history object. The
Innerheight returns the height of the window's document display area. The
Innerwidth returns the width of the window's document display area.
Length Sets or returns the number of frames in the window. The
location is used for the window or frame's location object. See Location object.
Name Sets or returns the name of the window. The
Navigator A read-only reference to the Navigator object. Please parameter Navigator object. The
opener returns a reference to the window that created this window. The
Outerheight returns the outer height of the window. The
Outerwidth returns the outer width of the window.
Pagexoffset Sets or returns the X position of the current page relative to the upper-left corner of the window display area.
pageYOffset Sets or returns the Y position of the current page relative to the upper-left corner of the window display area. The
Parent returns to the parents window. The
screen read-only reference to the Screen object. Please parameter screen object. The
Self Returns a reference to the current window. Equivalent to the Window property. The
status sets the text of the window status bar. The
top returns to the topmost ancestor window. The
Window Window property is equivalent to the Self property, which contains a reference to the window itself. The
Screenleft declares the X-and y-coordinates of the upper-left corner of the window on the screen.
Screentop IE, Safari, and Opera support Screenleft and Screentop
ScreenX declare the X-and y-coordinates of the upper-left corner of the window on the screen.
ScreenY Firefox and Safari support ScreenX and ScreenY

Window Object method
Method description
Alert () Displays a warning box with a message and a confirmation button.
Blur () Moves the keyboard focus away from the top-level window.
Clearinterval () cancels the timeout set by SetInterval ().
Cleartimeout () cancels the timeout set by the SetTimeout () method.
Close () Closes the browser window.
Confirm () Displays a dialog box with a message along with a confirmation button and a Cancel button.
Createpopup () Creates a pop-up window.
Focus () gives the keyboard focus to a window.
Moveby () Moves the specified pixel relative to the current coordinates of the window.
MoveTo () moves the upper-left corner of the window to a specified coordinate.
Open () Opens a new browser window or looks for a named window.
Print () Prints the contents of the current window.
Prompt () Displays a dialog box to prompt the user for input.
Resizeby () Resizes the window according to the specified pixel size.
Resizeto () Adjusts the size of the window to the specified width and height.
Scrollby () Scrolls the content by the specified pixel value.
ScrollTo () Scrolls the content to the specified coordinates.
SetInterval () invokes a function or evaluates an expression by the specified period (in milliseconds).
SetTimeout () invokes a function or evaluates an expression after the specified number of milliseconds.

Second, Navigator object; browser information. An instance of the Navigator object is unique.
Plugins[] Returns a reference to all embedded objects. is an array of Plugin objects, each representing a plug-in that the browser has installed, including a list of the MIME types it supports.
Plugins[] array is defined by IE, but it is always empty in IE 4, because IE 4 does not support plug-ins and Plugin objects.

Navigator Object Properties
Property Description
appCodeName returns the code name of the browser.
appMinorVersion returns the secondary version of the browser.
AppName returns the name of the browser.
AppVersion returns the platform and version information for the browser.
Browserlanguage returns the language of the current browser.
Cookieenabled returns a Boolean value that indicates whether cookies are enabled in the browser.
Cpuclass returns the CPU level of the browser system.
OnLine returns a Boolean value that indicates whether the system is in offline mode.
Platform returns the operating system platform running the browser.
Systemlanguage returns the default language used by the OS.
UserAgent returns the value of the user-agent header of the server sent by the client.
Userlanguage returns the natural language setting of the OS.

Navigator Object Methods
Method description
javaenabled () Specifies whether the browser enables Java.
Taintenabled () Specifies whether the browser enables data tainting.

Third, screen object; The client browser displays information about the screens.
The screen property of each Window object refers to a screen object.

Screen Object Properties
Property Description
Availheight returns the height of the display screen (in addition to the Windows taskbar).
Availwidth returns the width of the display screen (in addition to the Windows taskbar).
Bufferdepth Sets or returns the bit depth of the palette.
ColorDepth returns the bit depth of the palette on the target device or buffer.
DEVICEXDPI returns the horizontal dots per inch of the display screen.
DEVICEYDPI returns the number of vertical points per inch of the display screen.
fontSmoothingEnabled returns whether the user has enabled font smoothing in the Display control Panel.
Height returns the altitude of the display screen.
LOGICALXDPI returns the regular number of points that show the horizontal direction of the screen per inch.
LOGICALYDPI returns the regular number of points that show the vertical direction of each inch of the screen.
Pixeldepth returns the color resolution (bits per pixel) of the display screen.
UpdateInterval Sets or returns the refresh rate for the screen.
Widths returns the width of the display screen.

Iv. the History object; The URL that the user has visited (in a browser window).

History Object Properties
Property Description
Length returns the number of URLs in the browser history list.

History Object method
Method description
Back () loads the previous URL in the History list.
Forward () loads the next URL in the history list.
Go () Loads a specific page in the History list.

V. Location object; Information about the current URL.

Location Object Properties
Property Description
Hash sets or returns the URL (anchor) starting with the pound sign (#).
Host sets or returns the hostname and port number of the current URL.
Hostname Sets or returns the host name of the current URL.
HREF Sets or returns the full URL.
Pathname Sets or returns the path portion of the current URL.
Port Sets or returns the port number of the current URL.
Protocol sets or returns the protocol for the current URL.
Search Sets or returns the URL (query section) starting with the question mark (?).

Location Object Methods
Property Description
Assign () loads a new document.
Reload () reloads the current document.
Replace () replaces the current document with a new document.

BOM (Browser object model) browser objects models

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.