If you know a little about JS Code, you will generally knowwindow.location.href
This attribute. Use this property to obtain the URL of the page:
window.location.href = window.location.href;
Okay, I tell you, it's so weak. In fact, native JavaScript really has everything.
Properties of the window. location object
Attribute |
Description |
Hash |
URL (Anchor) starting from) |
Host |
Host name and port number of the current URL |
Hostname |
Host Name of the current URL |
Href |
Complete URL |
Pathname |
Path section of the current URL |
Port |
Port Number of the current URL |
Protocol |
Protocol of the current URL |
Search |
From Question mark (?) Start URL (query part) |
Take the mango small station as an example.window.location.href
Obtain a page parameter and obtain the following results:
Window. location. hash
You can use JS to locate the anchor.window.hash
Complete with the element ID. For example, to quickly locate a comment on the page, you can directly use the following code:
window.location.hash = "#comment-5981";
In addition, Twitter, Facebook, and Google have been widely used.#!
This form of hash method processes the URL backtracking function of Asynchronous Interactive pages.
Window. location. search
If there is such a URL:
http://www.google.com.hk/search?hl=zh-CN&source=hp&biw=1400&bih=935&q=%E8%8A%92%E6%9E%9C%E5%B0%8F%E7%AB%99&aq=f&aqi=&aql=&oq=
How can I capture parameters requested by PAGE GET using JS scripts? In fact, use it directlywindow.location.search
And then use the split method to traverse the free organization data format in a loop.
In addition, if you refresh the page based on your search criteria, you only need to setwindow.location.search
You can.