2

I have a redirection page which redirects the user to an external link. I saw other pages which are able to skip a page when user clicks the back button.

Specifically: -I have a page which is listing the products -When a user click on a product it goes to my redirection page. -And after 5 seconds he/she is redirected to the external page.

What i want to implement is: when the user is browsing to the external link and go back(in his history), i want to skip the redirection page and go to the listing instead of opening my redirection page again and redirect him again to external link.

I hope it is clear.

I saw other pages with the same structure to do it and i am wondering how i can achieve such a feature. Is it with .htaccess or any other magical function?

Thanks in advance

2 Answers2

1

Try using a hidden form element to send a hash or a code. Another possibility is to use AJAX with jQuery to display a dynamic application which will force the buyer/client from going back in history.

Phantom
  • 378
  • 3
  • 19
  • thanks for the fast reply :) can you please be a little more specific? maybe a link reference or something? –  Apr 04 '15 at 09:37
  • I want to construct my answer, so why do you need a redir page? I thought about trying to building this application in a single page, using jQuery and AJAX to talk with the PHP pages. – Phantom Apr 04 '15 at 09:40
  • since this is a big project i guess (and i prefer it as it is) it would be more complex and difficult since it includes a lot of functionality in the redirect page. i ll give it a try though. –  Apr 04 '15 at 09:49
0

Use the header function:

header("Cache-Control: no-cache, must-revalidate");
SaidbakR
  • 13,303
  • 20
  • 101
  • 195
  • Thanks for the answer, this solution seems to work only on firefox for me. it doesn't work on Chrome and android browser.. –  Apr 05 '15 at 13:07
  • @George For more details about using header() in such case, you may refer to [this answer](http://stackoverflow.com/questions/13640109/how-to-prevent-browser-cache-for-php-site) – SaidbakR Apr 05 '15 at 13:26