javascript automatic go back, ok or PHP |
javascript automatic go back, ok or PHP |
![]()
Post
#1
|
|
![]() Senior Member ![]() ![]() ![]() ![]() ![]() Group: Member Posts: 793 Joined: Jun 2006 Member No: 425,250 ![]() |
i need to know if there is a way to do the following:
>Click a link that goes to a page >have that page it goes to display a message like "this page isnt here" >and automatically redirect BACK (as in history BACK) one page?? |
|
|
![]() |
*mipadi* |
![]()
Post
#2
|
Guest ![]() |
I'm not a JavaScript guru. I do know that the last page in history can be accessed via JavaScript like this:
CODE history.go(-1) so if you can find a way to feed that to a redirect in JavaScript, you're set. You could do it with PHP, too. When clicking a link, this will give you the page that the user came from: CODE $_SERVER['HTTP_REFERER'] which you could then feed to header() like so: CODE <?php header('Location: ' . $_SERVER['HTTP_REFERER']); ?> The problem is that header() does not work if any text (i.e. html coding) has been written to the HTTP stream already. In other words, you can't send part of a webpage and then use header() to redirect. Maybe this will give you a place to start, though. |
|
|
![]() ![]() |