javascript - Go back to previous page if same domain -


i need create button go previous page if last page visited in same domain , have check page was. example if user come google, button have redirect homepage, if come www.domain.com/product button have redirect page, if come www.domain.com/static button have redirect homepage.

i tried php , $_server http referer , if protocol http woks fine, doesn't work https, redirects homepage. looks variable doesn't exists!

how can solve problem? javascript , history obj can help?

thanks

use session variable track current page , check @ next page, i.e.:

if (isset($_session['page_url'])) {   // visitor has seen page in domain   $previous_page = $_session['page_url']; } else {   // visitor comes outside, use home page   $previous_page = 'http://domain.com'; } // keep url of current page $_session['current_url'] = $_server['request_uri']; 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -