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.