0

Background:

I'm trying to update a website, and there is a Login.html page which will be redirected to when login is required.

But now the customer want to make the login page to slide from bottom (not redirect to).

I'm trying to make it with least effort. So I'm trying to let the original Login.html goes back always, and then on every page, detect whether the history.forward() page is the original Login.html, if yes, slide the new login page after loaded.


But it leads to a technical question, how to fetch the history.forward url only but don't go to that page? I've found the solution but not found.

Any good suggestion to my background target would also be appreciated.


Thanks to the comment, I already know that doing this on history is not allowed. But what if I store the visit stack on localStorage? And now the question reduced to how to distinguish different window? I want to store the visit stack according to the key of different window.

Alfred Huang
  • 17,654
  • 32
  • 118
  • 189
  • Use document.referer for previous page and see here for explanation on why you can't get URL's for security reasons in javascript http://stackoverflow.com/questions/3528324/how-do-you-get-the-previous-url-in-javascript – Onimusha Jun 19 '14 at 01:44
  • @Onimusha Don't assume `referer` will always work, some people disable it to improve privacy. – Oriol Jun 19 '14 at 01:50
  • ok, thank you @Onimusha, but I was only want the functional, so alternative solution on my site might work, for example, what about using localStorage to remember the visited page stack? – Alfred Huang Jun 19 '14 at 01:58
  • Looks like you need your own history stack refer : http://stackoverflow.com/questions/10846248/how-to-implement-my-own-history-stack-in-a-single-page-mobile-web-application – Okky Jun 19 '14 at 03:47

1 Answers1

0

After several effort, I found using the history.go method cannot lead to the solution.

But this purpose, we can maintain the visit stack on localStorage or cookie.

Alfred Huang
  • 17,654
  • 32
  • 118
  • 189