javascript - Is there a way to bind a handler to browser history back button? -
this question has answer here:
for example user came page example.com/home.html
page example.com/checkout.html
. wonder if there way assign history example.com/new_offers.html
?
so, when clicking browser button, instead of going home.html
user redirected new_offers.html
i know may sound awkward, it's example , thing need bit different. also, need using javascript (nothing server-side).
upd: figured out it'd clearer ask whether it's possible bind handler browser button (jquery):
$(browser.backbutton).click(function(e){ ... })
instead of going checkout page home page, can go new_offers, checks variable checked_out
. if checked_out
false, redirect user checkout passing along form information. if checked_out
true, display new_offers page. checked_out
set true @ checkout page.
in way, if user clicks @ checkout page, user go new_offers page.
i don't design means user has click twice previous website, satisfy goals.
in other words, current design this:
home --> checkout
instead, this:
home --> new_offers -- (redirect) --> checkout
so new_offers redirects checkout unless sees user has checked out.
Comments
Post a Comment