开发者

Reload previous visited page in javascript

I have a web page whithin开发者_开发百科 i have display an image, when someone clicked on the image, The image is poped-in. And then, there is a close button after viewing the photo.

Now, I would like to add the the event onclick one function that allow me to refresh/reload the page. So I will have this sequence ( close popin ==> back to the page ==> reload the page)

Am not good in JS, i would like to do it in javascript.


There are several ways you can do this, look here for more info.

A call to window.location.reload() will do the job.


If you want to completely reload the page (i.e. resending any POST requests that may have occurred), use location.reload(). If you do this on a POST request, the browser will ask you if you want to submit the data again (if you use this technique).

If you want to avoid resending a POST request but just GET the resource this time round, use location.href = location.href.


To reload the current page, you can use:

location.reload(true);

To reload the previous page, you can try:

history.go(-1);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜