Home  >  Article  >  Web Front-end  >  A small example of Javascript implementation to return to the previous page and refresh it_javascript skills

A small example of Javascript implementation to return to the previous page and refresh it_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:09:561149browse

Today I wrote a small page that prompts success. At the same time, it requires returning to the previous page and refreshing the operations on the previous page (such as deletion and addition). I searched it online and found basically 90 % of them all say to use window.history.go(-1), or use window.history.back(-1), and some say to use

to refresh the parent page on the child page.

Copy code The code is as follows:


After testing on the JSP page, after clicking the button to save the added items on the operation page and then jumping to the success prompt page, I found that they were not refreshed and were displayed after manual refresh. For those pasting and copying techniques, they have not been tested. The article is really sad.

Actually, for this technology, I have not found that it can be implemented completely relying on JS. One idea is to prevent the previous page from being cached and just read it out every time (I don’t understand the specific principles of other people’s ideas)

The implementation method of JSP is as follows:

Reply-text mb10 code

Copy code The code is as follows:




<%String rec = request.getHeader("REFERER");%>

< /STRONG>


<%String rec = request.getHeader("REFERER");%>

The implementation method of ASP page is as follows:

Copy code The code is as follows:

<%'Get the address of the previous page
address = request.ServerVariables("HTTP_REFERER")
%>

return

Reply-text mb10 code

Copy code The code is as follows:

. In servlet
request.getRequestDispatcher(request.getHeader( "referer")).forward(request,response);
or
request.getRequestURL();


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn