Bom:browserobjectmodel, the browser object model, provides JS in the browser of the various operations of the object, is the only part of the JS application does not have the relevant standards, the issue of the BOM often problems, mainly used to deal with the browser window and frame, Browser-specific JS extensions are also defaulted as part of the BOM, and public objects between browsers become the default standard. This article will focus on the Window object.
Properties
There is no model in the world, and it becomes a model with more. The model is a reference, a series of common objects in the BOM constitute this model, its structure can be shown as:
The six Properties of window, and they are also objects:
document primarily operates web -loaded webpage documents;
Frames is an array of window frame objects;
history to save users online records;
location provides information about the loaded documents as well as control page jumps;
Navigator object stores browser name and version information;
screen displays related information.
There are also several important property objects under the Document object property, and the structure of each object that operates on the document as the core is familiar to the DOM, and from this point of view, the DOM is actually BOM a subset of the.
window The object provides some basic properties for setting up browser information in addition to its six object properties, mainly as follows
We often need the location of the past browser and size information, because the BOM does not have a unified standard, for different browsers will have different properties to implement, At this point we need to do some cross-browser compatibility, so that the data for the object can be obtained for different browsers.
by using the TypeOf property to determine whether the browser supports the corresponding properties, the use of different measures is a good way of compatibility operation, can be applied to specific situations later.
Method windowsome of the main methods provided by the object are as follows:
The method is classified in simple way, and each method is divided into parameters, and the return values are different according to their respective conditions. See the name, the method name is no exception, see the names of these methods, the actual effect of the estimate has been guessed half, here is no longer detailed.
the window Object also provides additional methods: the Focus ()/blur (), the Close () method corresponding to open (), the scroll () scroll to the specified pixel point position, Print ()/find () brings up the printing dialog box and the Find dialog box, respectively.
Summary
BOM, is actually a set of objects, and window is the core of this group of objects, understand it, the entire browser object model also has a structure and the role of understanding.