Questions tagged [hashchange]

hashchange is a DOM window event that is fired when the URL's fragment identifier changes.

hashchange is a DOM window event that is fired when the URL's changes. Use this tag for questions related to this event and its related event handler onhashchange.

Resources

Related Tags

238 questions
568
votes
13 answers

On - window.location.hash - Change?

I am using Ajax and hash for navigation. Is there a way to check if the window.location.hash changed like this? http://example.com/blah#123 to http://example.com/blah#456 It works if I check it when the document loads. But if I have #hash based…
MilMike
  • 11,759
  • 12
  • 58
  • 78
301
votes
14 answers

Change the URL in the browser without loading the new page using JavaScript

How would I have a JavaScript action that may have some effects on the current page but would also change the URL in the browser so if the user hits reload or bookmark, then the new URL is used? It would also be nice if the back button would…
Steven Noble
  • 9,304
  • 12
  • 42
  • 56
91
votes
6 answers

Handle URL anchor change event in js

How can I write the JavaScript callback code that will be executed on any changes in the URL anchor? For example from http://example.com#a to http://example.com#b
87
votes
12 answers

jQuery - hashchange event

I am using: $(window).bind( 'hashchange', function(e) { }); to bind a function to the hash change event. This seems to work in IE8, Firefox and Chrome, but not in Safari and I assume not in earlier version of IE. For these browsers, I want to…
Ian Herbert
  • 871
  • 1
  • 6
  • 3
62
votes
7 answers

Detecting Back Button/Hash Change in URL

I just set up my new homepage at http://ritter.vg. I'm using jQuery, but very minimally. It loads all the pages using AJAX - I have it set up to allow bookmarking by detecting the hash in the URL. //general functions function getUrl(u) { …
Tom Ritter
  • 94,954
  • 29
  • 130
  • 168
31
votes
7 answers

How to show Ajax requests in URL?

What I want is to have links which change a part of the page , and a dynamic URL for it, where I can specify variables such like #calendar=10_2010tabview=tab2 Check this for an exact example: CLICK HERE FOR EXACT DEMO So here is the link format what…
Adam Halasz
  • 51,803
  • 63
  • 138
  • 208
23
votes
6 answers

What's the best library to do a URL hash/history in JQuery?

I've been looking around JQuery libraries for the URL hash, but found none that were good. There is the "history plugin", but we all know it's buggy and isn't flexible. I am loading my pages inside a div. I'll need a way to do back/forward along…
TIMEX
  • 217,272
  • 324
  • 727
  • 1,038
21
votes
7 answers

IE not marking links as "visited" when rendered via javascript

I am working with a site where all content is rendered via ajax postbacks using jquery. I am using Ben Alman's hashchange (http://benalman.com/projects/jquery-hashchange-plugin/) to manage the hash history which allows me to bookmark pages, use the…
TrippRitter
  • 305
  • 2
  • 10
18
votes
2 answers

jquery.history.js VS jquery-hashchange

See http://balupton.github.io/jquery-history/demo/ I was attracted with jquery.history.js mean while I found http://benalman.com/code/projects/jquery-hashchange/examples/document_domain/ I think the second one is just based on JQuery. I mean it…
Kuttan Sujith
  • 7,661
  • 18
  • 60
  • 89
17
votes
2 answers

Get the hashchange event to work in all browsers (including IE7)

I have some code (written by another developer) that is doing AJAX page loading inside of WordPress (e.g. no page reloads) when you click a nav item, AJAX refreshes the primary content area. My problem is that it's broken in IE7 and I have no idea…
Brian
  • 3,790
  • 12
  • 53
  • 99
12
votes
3 answers

How to open a URL with a hash using Selenium?

I'm trying to test my Backbone.js web application with Selenium IDE. Selenium can open my test case's initial URL so long as it's in a fresh browser window -- e.g. open /#/login -- but it times out whenever it tries to open subsequent URLs. It seems…
jabbett
  • 524
  • 1
  • 7
  • 20
10
votes
8 answers

How to keep the browser history in sync when using Ajax?

I'm writing a simple photo album app using ASP.NET Ajax. The app uses async Ajax calls to pre-load the next photo in the album, without changing the URL in the browser. The problem is that when the user clicks the back button in the browser, the app…
urini
  • 28,985
  • 13
  • 37
  • 37
9
votes
1 answer

Disable the hash change controller in JQuery mobile UI and replace with backbone.js

I'm using JQuery Mobile UI and the widgit kit is nice. However I'm also using backbone.js which comes with a really neat hashchange controller framework. Problem is that JQuery Mobile UI has an inbuilt crappy hash change controller which assumes you…
bradgonesurfing
  • 28,325
  • 12
  • 101
  • 188
8
votes
4 answers

Experiences with Javascript History Frameworks

I'm seeking a javascript history framework to handle navigation inside a page when the user selects multiple options which change the page behaviour. There are multiple artefacts on the page that change the data loading of the page and I'd like to…
Simon
  • 974
  • 7
  • 24
8
votes
4 answers

Backbone.js cause bug only in IE7

I'm developping a web app with CodeIgniter on back-end and Backbone.js on front-end. I'm also using HTML5 Boilerplate as my start template. I'm using Backbone's Controller and History as main navigation through my application. I've done it one time…
1
2 3
15 16