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 9202383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:14:42+00:00 2026-06-17T23:14:42+00:00

I am building a Html 5 website using push state and I wondering whether

  • 0

I am building a Html 5 website using push state and I wondering whether its possible in javascript or JQuery to detect whether the browser’s back button has been pushed. I would like to include it in an if statement like so:

if (back_btn clicked){
//do stuff
}
if (forward_btn clicked){

}
  • 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-17T23:14:44+00:00Added an answer on June 17, 2026 at 11:14 pm

    You’re looking for the popstate event.

    An example:

    window.onpopstate = function(event) {
        alert("location: " + document.location);
    }
    

    Or with the ever-popular jQuery:

    $(window).on('popstate',function(event) {
        alert("location: " + document.location);
    });
    

    This fires whenever history is accessed, such as back/forward. A quick note, in Chrome this also fires on the page load, so a quick way around is to check if the event is null.

    if(event.originalEvent.state!=null){
        // do something
    }
    

    Another good resource is the History.js jQuery plugin, which has a fallback using hashtags and such. It also makes detection of popstate events very straightforward.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If you are building a simple website using just simple HTML/CSS/Javascript that has say
I'm building a mobile app using HTML, CSS, Javascript and jQuery. Is there a
I'm building my website using only html and css. I've read several tutorials and
I am building my portfolio website simply using HTML , Flash , and the
I am building a Web2Print website using PHP, MySQL and jQuery.The main concept of
I'm building a website using this code <!DOCTYPE html> <html lang=en> <head> <meta charset=utf-8
I'm building a website using AngularJS and Rails. The HTML files that I'm using
I'm building a RSS feed of my website using jquery and the link element
I'm building a mobile website using HTML 5 and CSS with Query mobile I
i am building a website using asp.net mvc and jquery. as a best practice

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.