Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9088697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:57:42+00:00 2026-06-16T21:57:42+00:00

I have a web app that uses some subtle effects when navigating. Essentially the

  • 0

I have a web app that uses some subtle effects when navigating. Essentially the pages “slide” in from the right.

Everything in the app is based changes to the hash and all that is working great.

What I’m simply looking for is a way to determine if the change to the URL is a “back” action. I’m not going to try to affect the change– my app already handles that perfectly. I just want to reverse the “effect”. In other words, if I know they are clicking “back” I want to slide in from the left left instead of the usual action of sliding in from the right.

Keep in mind I don’t need help with the animation itself or keeping track of app state in the hash– I only need to know how to know if the change is a “Back” action.

Also, I really don’t want to keep a list of the hash states in the app as users click around to try and determine if they are going “back”. I might consider that if it’s really the only option, but I hoping to find a solution that just knows if the user initiated back (Back button, history.go(-1), right click “Go Back”, etc).

Is this information available in javascript without explicitly keeping track of changes to the hash?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T21:57:43+00:00Added an answer on June 16, 2026 at 9:57 pm

    Use a previous page variable. I’m going to assume that when you are “changing” pages you are doing it through a central function.

    In your goto page function

    // Try to get the previous page if known (will be 'unidentified' if unknown)
    var prevPage = window.previousPage;
    
    // Set this page as the previous before moving.
    window.previousPage = 'this page';
    
    // Assume that gotoPage is where we are headed
    if(gotoPage == prevPage)
    {
        // We're going back!
    }
    else
    {
        // We're going forward!
    }
    

    P.S.

    I am using the window.previousPage as the general container and using prevPage to compare in scope. This is on by design to limit the number of places you would have to set window.previousPage

    EDIT:

    Didn’t think about multiple going backs, same idea using an array (not tested but this is the general idea)

    var prevPage = '';
    
    if( Object.prototype.toString.call( window.previousPage ) === '[object Array]' )
        prevPage = window.previousPage[ window.previousPage.length - 1 ];
    
    if(prevPage == gotoPage)
    {
        // Splice out the last entry
        window.previousPage.splice( window.previousPage.length - 1, 1);
        // Going back DO NOT add new window.previousPage
    }
    else
    {
        // Going forward add the previousPage before changing
        window.previousPage[ window.previousPage.length ] = 'this page';
    
        // Move Page
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a fairly simple web app that uses cookies to store some information
Some colleagues of mine have a large Java web app that uses a search
I have an ASP.NET web app that uses a single page, but makes some
I have a web app. that uses AJAX (via jQuery). I noticed that some
I have a web app that uses some backend servers (UNC, HTTP and SQL).
I have a web app that uses some jars written by me. My challenge
I have a web app that uses the Active Directory Membership Provider and when
OK, I have a web app that uses PHP, MySQL and JavaScript. In an
I have a spring web app that uses Hibernate and Velocity. It's an MVC
I have a web-app with a Java back-end that uses Tomcat jdbc-pool for database

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.