Location object

xiaoxiao2021-03-06  80

Location object: Location provides URL information about the current open window or a specific framework. A multi-frame window object is displayed at the Location property is the URL of the parent window, each frame also has a location object with it.

Hash properties: Hash label is a URL good habitual usage, which specifies the browser to an Anchor location in the document, which is equivalent to a bookmark.

Host Attribute: Describe the hostname and port of the fishing song URL, only the port number is a clear portion of the URL, including the port number.

Hostname Property: The host name of a typical URL is the name of the server on the network, which stores the documentation that can be viewed on your browser. For most Web sites, the server name includes not only a domain name, but also a WWW prefix, if the port number is in the URL, the host name does not include, but included in the Host property.

HREF Attribute: This property provides a string of the entire URL of the specified window object.

Pathname Properties: The path name portion of the URL consists of a directory structure associated with the server root volume. The root is not part of the directory, if the path of the URL is a file to the root directory, then the location.pathname property is (/).

Port attribute: The port number is rarely used. When pointing to a URL that does not assign a domain name, you can get this value with the location.port property. If you get the value from a URL and you want to create a URL, you must include server IP addresses and segment slogan, IP The address and segment slogan are bound to the (:).

Protocol properties: including the protocol name, and follow the (:) points.

Assign: Assign ("URL") You can implement a new URL to the Location object through this method. Of course, you can also use the method directly assigned to implement, or Location.href to navigate to a new web page. The method of using Assign will make the code easy to maintain.

RELOAD method: This method can save the browser in memory (in a record) document settings all ignore, reopen the document, and the refresh on the browser is different. Its effect seems to be the same as the File menu Open file. Of course, if you don't want to do this, don't want to do this, there is a similar method than this method, which is the history.go () method.

Replace method: When the user comes from the current webpage, jumps to other web pages, sometimes I want to see the previous webpage in the back button (back), tell you a method, which is to use Location.Replace ("URL") This function can be achieved.

转载请注明原文地址:https://www.9cbs.com/read-121757.html

New Post(0)