Location.href usage summarizes the most important of

  • 2020-03-30 01:06:18
  • OfStack

Location.href in javascript can be used in a number of ways, mainly as follows.

Self.location.href = "/url" the current page opens the url page

Location.href = "/url" the current page opens the url page

Windows.location.href= "/url" the current page opens the url page and the first three USES are the same.

This.location.href = "/url" the current page opens the url page

Parent.location.href = "/url" opens a new page on the parent page

Top.location.href = "/url" opens a new page on the top-level page

If you have a custom frame on the page, you can change parent self top to the name of the custom frame by opening the url address in the frame window

In addition, the window. The location. Href = window. The location. The href; Window.location.reload () and both refresh the current page. The difference is whether data is submitted. When data is submitted, window.location.reload () will prompt whether or not to submit, window.location.href=window.location.href; Is to submit the data to the specified url

Related articles: