JavaScript object BOM summary
JavaScript object BOM summary
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
Development tools and key technology: Adobe Dreamweaver JavaScript
Author: wen-jian tang
Time to write: on April 27, 2020,
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
BOM (Browser Object Model)
BOM in JS object by object to manipulate the browser
The navigator (navigator)
UserAgent (user agent)
ActiveXObject object (active)
Check browser types by the navigator (navigator) to view your browser but the kinds of the disadvantages
This is better than the navigator userAgent (user agent) columns: the console. The log (the navigator. UserAgent);
Can combine the two to determine what browsers:
Var ua=window. The navigator. UserAgent;
If (/firefox/i.t est (ua)) {
Alert (" this is firefox ");
} else if (/chrome/i.t est (ua)) {
Alert (" this is Google browser ");
} else if (msie/i.t est (ua)) {
Alert (" this is Internet explorer ");
} else if (" ActiveXObject "in Windows) {
Alert (" this is IE11 browser ");
}
Due to the particularity of IE11 to use ActiveXObject (active object) "in the window,
The History (historical objects)
Just remember to go (1) the browser on a page, go back (1) a page 0 estimates is this page
Column: & lt; Button onClick="history. Go (1);"> The go (1) & lt;/button>
Location object attribute diagram:
Hash: this is on behalf of the current page from the name of the # # start
The Host and port number and Host the current URL
The Hostname: returns the current host URL
The Pathname: set the port number to? The area between the
Pore, set to return to the current port
Protocol: return or set the current path at the beginning of
Search: set or return? And content between #,
Position location. The replace (replace)
In parentheses in the replacement of path, this and A tag is A bit like A label but not jump can change back after this,