[英]Go to the Previous Webpage When You Click a Link
I have a website, written in PHP, html and javascript. 我有一个网站,用PHP,html和javascript编写。
The base of my problem is I need a 'back' link on a webpage to take you to the page you last came from, as you can get to the webpage through different pages. 我的问题的基础是,我需要网页上的“后退”链接以将您带到最后一个来源的页面,因为您可以通过不同的页面访问该网页。
Below is a scenario that should help explain. 下面是一个应该有助于解释的方案。
There are different sectors, for example: 有不同的部门,例如:
Hospital Courses Ambulance Courses 医院课程救护课程
And different courses, for example: 和不同的课程,例如:
Course 1 Course 2 课程1课程2
There is a link for Course 1 from both the Hospital Courses page and the Ambulance Courses page, which takes you to the Course 1 Page. “医院课程”页面和“救护车课程”页面都有课程1的链接,可将您带到课程1页面。
The Course 1 page has a link, which will say Back. “课程1”页面上有一个链接,该链接将显示“上一步”。
If you came from Hospital Courses, I need the link to take you back there, and if you came from the Ambulance Courses, you need to be taken back to that page. 如果您来自医院课程,我需要链接才能带您回到那里,如果您来自救护课程,则需要回到该页面。
Does anyone know if you can do this, and how to go about doing it? 有谁知道您是否可以这样做,以及如何去做?
The link is: 链接是:
<a href="javascript:history.back()">text</a>
or 要么
<a href="javascript:history.go(-1)">text</a>
(I see that a fair bit, I don't know if history.back()
is newer or what...) (我知道,我不知道history.back()
是较新的还是什么...)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.