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

241 questions
8
votes
3 answers

Is it possible to capture the window.location.replace event?

If I'm currently at the URL"example.com/somepage#somehash" and I invoke window.location.hash = "anotherhash", the URL changes to "example.com/somepage#anotherhash". This fires the window.hashashchange event. If I am currently at the URL…
abalter
  • 9,663
  • 17
  • 90
  • 145
7
votes
6 answers

JavaScript/jQuery - onhashchange event workaround

Until all browsers support the onhashchange event what is the best workaround for this? Is there something for this in jQuery? or as a plug-in?
MJLefevre
  • 815
  • 1
  • 8
  • 15
7
votes
1 answer

Prevent history propagation to the parent window

I have 2 simple html pages: parent and child. Parent stores child inside the iframe. Parent.html:
Kiril
  • 2,935
  • 1
  • 33
  • 41
6
votes
2 answers

$(window) bind hashchange how to check part hash changed?

I am studing Google Ajax Crawlable I use $(window) bind hashchange to control ajax page loading. my url like: domain.com/#!/keywords&num=1 there has two kind of change domain.com/#!/apple&num=1 =>…
Giberno
  • 1,323
  • 4
  • 17
  • 31
6
votes
2 answers

Onhashchange with browser buttons only

I've got this issue (I'm using jQuery but I'm not restricted to it): I'm using a combo of Anchor navigation (#id) and Ajax requests. To get the pages to move into place (using anchor navigation) or to fetch information (using Ajax), I use the…
Patrik
  • 132
  • 1
  • 2
  • 8
6
votes
2 answers

How to detect automatic scrolling to anchors?

I have a one page website, example.com. There are two sections: intro at the top of the page, and contact at the bottom of the page. If I want someone to visit the contact section without having to scroll through the intro, I give them this link:…
Tamás Bolvári
  • 2,976
  • 6
  • 34
  • 57
6
votes
5 answers

How to "bookmark" page or content fetched using AJAX?

How to "bookmark" page or content fetched using AJAX? It looks like it can be easy if we just add the details to the "anchor", and then, use the routing or even in PHP code or Ruby on Rails's route.rb, to catch that part, and then show the content…
nonopolarity
  • 146,324
  • 131
  • 460
  • 740
6
votes
1 answer

hashchange event not triggered in IE10 & IE11 with combo of history.pushState and url manual manipulation

I'm having trouble getting the hashchange event to trigger consistently in IE10 and IE11 If I use history.pushState to alter the current hash and then manipulate the hash in the url, then hashchange will be triggered once. Then if the above is…
6
votes
4 answers

jquery: hashchange, prevent jumping to hash

I have a hashchange function set up to show/hide different sections of an about page without having 7 separate pages. This all works fine, great infact, there's just one small thing that's bothering me, when the relevant content is shown on screen,…
user1374796
  • 1,544
  • 13
  • 46
  • 76
6
votes
3 answers

jquery history plugin

I am using this plugin: http://plugins.jquery.com/project/history on this page: http://www.crtaci.info/index.php?autocom=majice I dont know why but it seems i cant figure out what to do to get this to work... Guess i need more sleep... :)
Gavrisimo
  • 1,827
  • 5
  • 25
  • 33
6
votes
1 answer

Dynamicpage divs flash shortly after loading new content

I'm using the dynamicpage script to load content via Ajax into my page. Everything works fine besides 1 issue. I have a page with the divs stacked beneath each other So for example: header-banner-nav-content-likebox-twitterwidget-footer. If I change…
Eric
  • 177
  • 2
  • 13
5
votes
1 answer

Correctly encoded string gets decoded when pushed into window.location.hash

The goal: Correctly put a string from a data attribute into the window.location.hash. The code: map = {path: $(this).attr('data-path'), rev: $(this).attr('data-rev')}; window.location.hash = getMapParams(map); function getMapParams(map) { s=""; …
Wilgert
  • 706
  • 1
  • 6
  • 23
5
votes
5 answers

Javascript/jQuery detect hash change only on browser back/forward button click

Is it possible to detect the hashchange only on a browser history change (i.e. Back or Forward button)? I have seen the onBeforeUnload event, but this event does not fire on hash change, as the window is not unloading. The hashchange event obviously…
Chris
  • 4,762
  • 3
  • 44
  • 79
5
votes
2 answers

binding hashchange event in IE7 issue

I am experiencing some issues binding to the hashchange event in Internet Explorer 7. All other versions of Internet Explorer - ie. 8 & 9 work without issue. My code is: $(window).bind('hashchange', function (e) { alert('hash changed'); }); When…
amateur
  • 43,371
  • 65
  • 192
  • 320
5
votes
1 answer

Disabling hashchange listener when updating hash programatically (jQuery BBQ)

To prevent a feedback loop when setting the URL hash (#) programmatically (in contrast to manually changing the URL) I want to disable the hashChange listener temporarily. How should I change this code to actually disable the hashchange event when…
dani
  • 4,880
  • 8
  • 55
  • 95
1
2
3
16 17