In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
Editor to share with you what is the use of location in javascript, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
The location address object describes the address opened by a window object. To represent the address of the current window, simply use "location"; to represent the address of a window, use ".location".
Protocol returns the protocol of the address, with a value of 'http:','https:','file:', etc.
Hostname returns the hostname of the address, for example, an "http://www.microsoft.com/china/" address, location.hostname = = 'www.microsoft.com'."
Port returns the port number of the address. Generally, the port number of http is' 80'.
Host returns the host name and port number, such as: 'www.a.com:8080'.
Pathname returns the pathname, such as "http://www.a.com/b/c.html" journal location.pathname = = 'bmax e.html'.
Hash returns "#" and later content, such as "http://www.a.com/b/c.html#chapter4" location. Hash ='# chapter4';. If there is no" # "in the address, an empty string is returned.
Search returns "?" And later content, such as "http://www.a.com/b/c.asp?selection=3&jumpto=4" selection=3&jumpto=4';. Search ='? if there is no"? "in the address, an empty string is returned.
Href returns all of the above, that is, the entire address. Return it as it is displayed in the browser's address bar. If you want a window object to open an address, you can use "location.href = '...'" or you can directly use "location = '...'" To achieve this goal.
Method
Reload () is equivalent to pressing the "IE" or "Reload" (Netscape) keys on the browser.
Replace () opens a URL and replaces the address of the current location in the history object. After opening a URL in this way, pressing the browser's "back" button will not return to the previous page.
The above is all the content of this article "what is the use of location in javascript?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.