Home > Article > Web Front-end > Introduction to BOM in JavaScript (code example)
This article brings you an introduction to BOM in JavaScript (code examples). It has certain reference value. If necessary, Friends can refer to it, I hope it will be helpful to you.
BOM refers to the browser object model, which can operate the browser through js.
window - The entire browser window is also the global object of the web page
navigator - Browser information
location - Browser address bar information, you can obtain the address or operate
history - Browser history record of this object Specific history records cannot be obtained, and the browser can only be operated forward or backward.
screen - Get information about the monitor screen currently used by the user
var userAgent = navigator.userAgent; if (/firefox/i.test(userAgent)) { alert("你是火狐"); } else if (/chrome/i.test(userAgent)) { alert("你是chrome"); } else if("ActiveXObject" in window){ alert("你是ie"); }history History record
var next=document.getElementById("next"); var prev=document.getElementById("prev"); next.onclick=function(){ // history.forward(); history.go(1); } prev.addEventListener("click",function(){ // history.back(); history.go(2); },false)
The above is the detailed content of Introduction to BOM in JavaScript (code example). For more information, please follow other related articles on the PHP Chinese website!