A BOM object window's related property 1. User Configuration machine Configuration Object Navigator
Navigator.useragent//This property can be viewed in the configuration of the user's machine browser "mozilla/5.0 (IPhone; CPU iPhone os 8_0 like Mac os X applewebkit/600.1.3 (khtml, like Gecko) version/8.0 mobile/12a4345d safari/600.1.4 "
2. User URI Access address location
Hosts: Host: "Www.baidu.com"
Host Name: hostname: "www.baidu.com"
Full uri:href: "Http://www.baidu.com/s?wd=%E5%A6%82%E4%B"
Domain name: Origin: "Http://www.baidu.com"
Path: Pathname: "/S"
Port number: port: ""
Protocol type: Protocol: "http:"
Reload: reload:function direct call without parameters
Reload: Replace:function does not generate in history after a parameter call
GET parameter: Search: "? Wd=aaa&lang=zh_cn&name=lizsi"
Gets the parameters on the user URL //directly using GetParam (' name ') function GetParam (param) { var Getarr = ( Window.location.search.substring (1)). Split (' & '); var getparam = {}; for (Var j in Getarr) { var temp = getarr[j].split (' = '); Temp[0] = Temp[0].replace (",");//Remove the space in the variable name getparam[temp[0]] = temp[1]; } return Getparam[param]; } For PathInfo mode acquisition direct use of getpathinfo (1); Starting from 1 function GetPathInfo (index) { var Getarr = (window.location.pathname.substring (1)). Split ('/'); Return Getarr[parseint (Index)-1]; }
3. Historical visit History
Only allow access to history under this domain name
Back page: back:function direct call without parameters
Forward one page: forward:function direct call without parameters
Returns the specified page: go:function-1 back one page 0 refresh the current Page 1 forward page 2 forward two pages
Pushstate:function () parameter
Replacestate:function () parameter
See http://www.zhangxinxu.com/study/201306/ajax-page-html5-history-api.html?area=pudong//Click to add history var query = This.href.split ("?") [1];history.pushstate ({title:title}, title, Location.href.split ("?") [0] + "?" + query), var title = $ (This). Text (). Replace (/\d+$/, "");d Ocument.title = title; Listen for related event Window.addeventlistener ("Popstate", function () { history.replacestate (null, Document.title, Location.href.split ("?") [0]; });
4. Screen Object Screens
Screen visible Height: availheight:667
Screen visible Width: availwidth:375
Screen resolution: Colordepth:24
Screen Height: height:667
Screen width: width:375
availleft:0
availtop:0
two DOM object document1. Caching Cookies
Directly using Cookieparam (' name ') function Cookieparam (param) { var getarr = Document.cookie.split (';'); var getparam = {}; for (Var j in Getarr) { var temp = getarr[j].split (' = '); Temp[0] = Temp[0].replace (",");//Remove the space in the variable name getparam[temp[0]] = temp[1]; } return Getparam[param]; }
JS Object-Oriented Learning Note IX (BOM and DOM common attribute analysis)