# onHashChange buggy in IE6 & IE7

**URL:** <https://forum.kirupa.com/t/onhashchange-buggy-in-ie6-ie7/316382>\
**Category:** web dev\
**Created:** [November 19, 2010, 10:18pm UTC](https://forum.kirupa.com/t/onhashchange-buggy-in-ie6-ie7/316382 "2010-11-19T22:18:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![NeoDreamer](https://avatars.discourse-cdn.com/v4/letter/n/ccd318/32.png) [@NeoDreamer](https://forum.kirupa.com/u/NeoDreamer)\
**Post date:** [November 19, 2010, 10:18pm UTC](https://forum.kirupa.com/t/onhashchange-buggy-in-ie6-ie7/316382/1 "2010-11-19T22:18:45Z")

</div>

I’m programming my own Ajax history library in JS. I ran into problems with IE6 and IE7. I wish to learn why the following are happening before I download some huge library that implements Ajax history.

**IE6 & 7**

I am able to set the hash values without refreshing the page.

```php

window.location = 'site.com/index.html#' + pageNumber;

```

I can go to page 1, page 2, page 3, and so on. When I’m on page 3 and hit the back button, I’m not transported back to page 2. Rather, I get completely taken out of index.html! It seems like IE does not think that different hash values are different points in history.

**IE7**

IE8 in IE7 backwards compatibility mode claims that it has the onhashchange listener.

```php

if ('onhashchange' in window) {
   // true in IE7
   window.onhashchange = someFunction();
}

```

However, IE7 never executes someFunction() when the URL changes. This implies that it lies about having onhashchange but never implemented it.
