Use the hashchange
event:
window.addEventListener("hashchange", function(e) {
// ...
})
If you need to support older browsers, check out the hashChange
Event section in Modernizr’s HTML5 Cross Browser Polyfills wiki page.
More Related Contents:
- Understanding members of Symbol – function constructor
- I need a RegExp which accepts only accepts slashes in text box?
- Check variable equality against a list of values
- Custom attributes – Yea or nay?
- Regex to get string between curly braces
- Call AngularJS from legacy code
- Using _ (underscore) variable with arrow functions in ES6/Typescript
- Failed to execute ‘btoa’ on ‘Window’: The string to be encoded contains characters outside of the Latin1 range.
- What is the difference between parseInt(string) and Number(string) in JavaScript? [duplicate]
- How to get JQuery.trigger(‘click’); to initiate a mouse click
- How do I reset the setInterval timer?
- Getting a list of associative array keys
- How can I remove the “No file chosen” tooltip from a file input in Chrome?
- Populate one dropdown list based on the selection of other dropdown list
- How much faster are arrays than accessing Google Sheets cells within Google Scripts?
- How to capture Enter key press? [duplicate]
- Is any JavaScript code a valid TypeScript code?
- Javascript Append Child AFTER Element
- Creating a collapsed range from a pixel position in FF/Webkit
- How to pass an EL variable to javascript
- CORS and Google Maps Places Autocomplete API calls [duplicate]
- JavaScript filter array by data from another
- I can’t reference an image in Next.js
- Reactjs-setState previous state is the first argument, props as the second argument
- Use Django template tags in jQuery/Javascript?
- Javascript DOM: Setting custom DOM element properties
- React.js best practice regarding listening to window events from components
- Adding rows with ng-repeat and nested loop
- monitoring history.pushstate from a chrome extension
- HTML2Canvas does not render full div, only what is visible on screen?