JavaScript Learning (2-2)

Source: Internet
Author: User

Reference: http://www.w3cschool.cc/js/js-window.html

Iv. Browser BOM

The browser object Model (BOM) gives JavaScript the ability to "talk" to the browser.

(1) Window

There is no formal standard for the browser object model (Browser).

All Browsers support window objects, which represent browser windows.

Even the document of the HTML DOM is one of the properties of the Window object: Window.document.getElementById ("header");d Ocument.getelementbyid ("header") ; var W=window.innerwidth | | Document.documentElement.clientWidth | | Document.body.clientwidth;var H=window.innerheight | | Document.documentElement.clientHeight | | Document.body.clientHeight;
window.open (); Open a new Window window.close (); Close the current window Window.moveto (); Move the current window Window.resizeto (); Adjust the current window

(2) Window screen

The Window.screen object contains information about the screen.

Screen.availwidth; Available screen width screen.availheight; Screen height available screens {availwidth:1366, availheight:738, width:1366, height:768, colordepth:24, pixeldepth:24, top:0, le ft:0, availtop:0, availleft:0}

(3) Window location

The Window.location object is used to obtain the address (URL) of the current page and redirect the browser to a new page.

Location.hostname; Returns the domain name of the web host location.pathname; Returns the path and file name of the current page location.port; Returns the port of the web host (80 or 443) Location.protocol; Returns the Web protocol used (HTTP///https://)

(4) Window history

Window.history object contains the history of the browser








JavaScript Learning (2-2)

Related Article

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.