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

  • SEARCH
  • Home
  • 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 7883201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:28:14+00:00 2026-06-03T04:28:14+00:00

My Google-fu pulls up nothing. When you do this: var stateObj = { state:

  • 0

My Google-fu pulls up nothing.

When you do this:

var stateObj = { state: "some state" };
history.pushState(stateObj, "page 2", "other.htm");

Is there an associated window callback?

I know that there’s this:

window.onpopstate = function() {

}

Which works great for listening to when a user hits the back button. However, I want to listen to any time the URL changes at all, and I’m not sure how to do it.

Is there a global callback for anytime the URL changes?

  • 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-03T04:28:16+00:00Added an answer on June 3, 2026 at 4:28 am

    No, there’s not a onpushstate or whatever. However, a little monkey patching can fix that:

    var pushState = history.pushState;
    history.pushState = function () {
        pushState.apply(history, arguments);
        fireEvents('pushState', arguments);  // Some event-handling function
    };
    

    This will only notify you when pushState is used. You’d probably want to do something similar for replaceState.

    If you need to be notified whenever the URL changes at all, some combination of the above and a hashchange handler will get you most of the way there.

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

Sidebar

Related Questions

Google returns me just nothing useful on these keywords. But I know there is
I don't have a good C++ book on hand and google pulls ups nothing
I have a page that pulls an external JavaScript file, which then generates some
Google wasn't my friend this time. This is the closest to a doc I
I am currently working on an application that pulls Google Map locations from an
this is really rudimentary but I'm tired of searching google and I have no
I have a web app which pulls in information via ajax after the page
I have a Google style instant search script written in jQuery which pulls results
I ran into some code I couldn't find an answer to on Google or
In a <div> there are two <span> . One pulls in an image of

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.