Location. href usage Summary (most important)

Source: Internet
Author: User

Location. href in javascript has many usage methods, 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. The previous three operations 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 page.

If the frame is customized on the page, you can replace parent self top with the name of the custom frame to open the url address in the frame window.

In addition, window. location. href = window. location. href; and window. location. Reload () both refresh the current page. The difference is whether data is submitted. When data is submitted, window. location. Reload () will prompt whether to submit. window. location. href = window. location. href; then the data is submitted to the specified url.

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.