简体   繁体   English

如何使“返回分页”按钮返回到上一个分页页面

[英]How to make the back to pagination button go back to previous pagination page

I have added a Back To Gallery button which appears in the image showcase page for a photography website gallery. 我添加了一个“ Back To Gallery按钮,该按钮出现在摄影网站画廊的图像展示页面中。

However when the button is clicked it goes back to the pagination's first page, I would like the button to direct the user back to the previous pagination page when clicked. 但是,当单击按钮时,它会返回到分页的第一页,我希望在单击该按钮时可以将用户引导回上一个分页。

As an example if the image clicked was in pagination number 22 when the image is clicked and after user views the image and want to go back the button has to take the user back to pagination 22 not going back to pagination 1. 例如,当单击图像时,如果单击的图像在分页号22中,并且用户查看图像并想返回后,该按钮必须使用户回到分页22,而不要回到分页1。

With php you can relocate a user with 使用php,您可以使用

header('Location:'.$_SERVER['HTTP_REFERER']);

$_SERVER['HTTP_REFERER'] stands for de user his previous page $_SERVER['HTTP_REFERER']代表取消用户的上一页

With javascript you can relocate a user with 使用javascript,您可以使用

<a href="#" onclick="window.history.go(-1); return false;" class="btn btn-primary">
   <i class="fa fa-undo"></i>go back
</a>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Vue cli中的浏览器后退按钮上进行分页和内容呈现? - How to make pagination and content render on browser back button in Vue cli? 如何使后退按钮转到上一页而不是跳转内部链接? - How do I make the back button go to the previous page instead of jumping internal links? 防止浏览器后退按钮不转到上一页 - Prevent browser back button to not go to previous page Cakephp 2,返回/取消按钮转到上一页 - Cakephp 2, back/cancel button to go to the previous page 返回上一页 - Go Back to Previous Page 与ajax后退按钮的分页链接不返回 - pagination links with ajax back button not going back 即使更改了哈希值,如何在网页中单击浏览器后退按钮时返回上一页? - How to go back to the previous page when browser back button is clicked in a webpage even when the hash is changed? 当按下浏览器后退按钮(在 Javascript 中)时,如何将特定变量传递给 go 返回上一页? - How to pass a specific variable to go back to the previous page when the browser back button is pressed (In Javascript)? 使后退按钮转到其他页面 - Make back button go to a different page 在 Vue 中,如何使用 window.history.go(-1) 使浏览器到 go 返回上一页 - In Vue, how to make browser to go back to previous page using window.history.go(-1)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM