Recommendation of five methods for page Jump using js and five methods for js page Jump

Source: Internet
Author: User

Recommendation of five methods for page Jump using js and five methods for js page Jump

Recommendation of five methods for page Jump using js

First:
Copy codeThe Code is as follows:
<Script language = "javascript" type = "text/javascript">
Window. location. href = "xx. jsp? Backurl = "+ window. location. href;
</Script>

Second:
Copy codeThe Code is as follows:
<Script language = "javascript">
Alert ("return ");
Window. history. back (-1 );
Window. history. go (-1 );
</Script>

Third:
Copy codeThe Code is as follows:
<Script language = "javascript">
Window. navigate ("xx. jsp ");
</Script>

Fourth:
Copy codeThe Code is as follows:
<Script language = "JavaScript">
Self.location='xx.htm ';
</Script>

Category 5:
Copy codeThe Code is as follows:
<Script language = "javascript">
Alert ("illegal access! ");
Top. location = 'xx. jsp ';
</Script>

Summary:
Self: current window object (if it is in iframe, It is the window object of the Framework)

Top: parent window object

Window: in typical cases, the browser creates a window object for each opened html. If this document contains multiple frameworks, the browser creates a window object for the original document, create an additional window object for each frame. You can directly use all the properties, methods, and sets of the window in the current window, that is, you do not need to append the expression that calculates the result as the current window object. Although window can be omitted, this keyword is generally used to facilitate reading and avoid some vulnerabilities.
Location: This object contains the current url Information and has multiple attributes. The default attribute is location. href, indicating the whole url, that is, if you set location = "http://www.bkjia.com", it is equivalent to location. href = "http://www.bkjia.com ". self: current window object (if it is in iframe, It is the window object of the Framework)

Window. navigate ("http://xx.html/") This method is only for IE, not applicable to Firefox and other browsers, in the html dom Window Object, there is no list of windows. navigate this method, so this method should be used as little as possible.
The window. location attribute is compatible with all browsers. Therefore, this is commonly used when page Jump is implemented.
Window. history. go (-1) is returned to the previous page.
Window. location. go (-1) is used to refresh the previous page.

The five recommended methods for implementing page Jump In this js article are all the content shared by Alibaba Cloud xiaobian. I hope to give you a reference and support for the help house.

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.