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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:16:03+00:00 2026-06-03T16:16:03+00:00

I use to listen to hashchange handler event. But now with HTML5 you can

  • 0

I use to listen to hashchange handler event. But now with HTML5 you can change the url without using the hash. How can add a listener to 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-03T16:16:05+00:00Added an answer on June 3, 2026 at 4:16 pm

    hash-changes can happen even without the use of JS. Like the default behaviour of clicking an anchor link can trigger a hash-change.

    The HTML5 history object can only be manipulated through JS. For this there is pushState() and replaceState(). Once used, the browser back and forward buttun will trigger the popstate event. There are no other event handlers that I know of for HTML5 History.

    $(window).bind("popstate", function() {
        console.log(window.location.href);
    });
    

    If you require a trigger whenever something is pushing states to the history object, then you should rely on the whoever is calling this to allow observers (callbacks) for it.

    Otherwise you could try something something not so robust:

    function onPushState(callback) {
        (function(pushState) {
           history.pushState = function() {
               pushState.apply(this, arguments);
               callback.apply(window, arguments);
           };
        })(history.pushState);
    }
    
    onPushState(function() {
        console.log(window.location.href);
    });
    

    http://jsfiddle.net/Cxjey

    You could do the same of replace state.

    Again, this might not be a good idea as you are changing default browser behaviour.

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

Sidebar

Related Questions

I'm using http://benalman.com/projects/jquery-hashchange-plugin/ to listen for hash changes in my project, but his plugin
I use change(handler) to listen to change events to a textarea, but I only
I am using node.js connect framework to listen to upgrade event. I can use
I can use HttpListener to listen for requests coming from the same computer, but
any good framework I can use to listen for touch, swipes and pinch actions?
Now I want to use a serversocket to listen port x, in the same
What language or method would I use to listen to the event when a
I need to use idle listener to listen the user is using the application
I know I can use componentResized to listen for when the user resizes a
I understand how I can use a raw socket to listen to a server

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.