Window.location method

Source: Internet
Author: User
window.locationMethod gets the URL Uniform Resource Locator (uniform Resource Locator, URL) The complete URL is composed of these parts: Scheme://host:port/path?query#fragment Scheme: Communication protocol   Commonly used Http,ftp,maito: host (with port number) server (computer) domain Name System (DNS) hostname or IP address.   Port: The port number is an integer, optionally, the default port for using the scheme when omitted, such as the default port for HTTP is 80.   Path: A string separated by 0 or more "/" symbols, typically used to represent a directory or file address on a host. Query: Queries are optional for dynamic Web pages, such as using CGI, ISAPI, php/jsp/asp/asp.   NET, and other technology-made pages, can have multiple parameters, separated by the "&" symbol, and the name and value of each parameter are separated by the "=" symbol. Fragment: An information fragment string that specifies a fragment in a network resource. For example, a Web page has multiple noun interpretations, which can be directly positioned to a noun interpretation using fragment.   (also known as anchor points.) Example: Http://www.home.com:8080/windows/location/page.html?ver=1.0&id=timlq#love 1, window.location.href the entire URL string (In the browser is the complete address bar) return value: Http://www.home.com:8080/windows/location/page.html?ver=1.0&id=timlq#love 2, The protocol portion of the Window.location.protocol URL returns the value: the host portion of the Http:3,window.location.host URL (with the port number),

return value: www.home.com:8080

Window.location.hostname

        return value: Www.home.com
4,window.location.port The port portion of the URL.   If you use the default port 80 (update: Even if you added: 80), the return value is not the default 80 but the null character.   This example returns the value: 8080 5,window.location.pathname the path portion of the URL (that is, the file address) return value:/windows/location/page.html 6,window.location.search The query (Parameters) section. In addition to assigning values to dynamic languages, we can also give static pages and use JavaScript to get the value returned by the values that are believed to be expected:? VER=1.0&ID=TIMLQ 7,window.location.hash Anchor Point return value: #love

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.