host represents the concatenation hostname:port.
the location object is contained by the window object and is within its scope. if you reference a location object without specifying a window, the location object represents the current location. if you reference a location object and specify a window name, for example, windowreference.location.propertyname, the location object represents the location of the specified window.
do not confuse the location object with the location property of the document object. you cannot change the value of the location property (document.location), but you can change the value of the location object's properties (window.location.propertyname). document.location is a string-valued property that usually matches what window.location.href is set to when you load the document, but redirection may change it.
语法 for common url types
when you specify a url, you can use standard url formats and javascript statements. the following list shows the 语法 for specifying some of the most common types of urls.
| url type | protocol | example |
|---|---|---|
| javascript code | javascript: | javascript:history.go(-1) |
| navigator info | about: | about:cache |
| world wide web | http: | http://www.netscape.com/ |
| file | file: | file:///javascript/methods.htm |
| ftp | ftp: | ftp://ftp.mine.com/home/mine |
| mailto | mailto: | mailto:info@netscape.com |
| usenet | news: | news://news.scruznet.com/comp.lang.javascript |
| gopher | gopher: | gopher.myhost.com |
the javascript: protocol evaluates the expression after the colon (:), if there is one, and loads a page containing the string value of the expression, unless it is undefined. if the expression evaluates to undefined, no new page loads.
the about: protocol provides information on navigator and has the following 语法:
about:[cache|plugins]about: by itself is the same as choosing about netscape from the navigator's help menu.
about:cache displays disk cache statistics.