I have a website, written in PHP, html and 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
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.
The Course 1 page has a link, which will say Back.
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...)