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 where to start in terms of debugging.
The original opening lines were
var queue = 0;
$('document').ready(function() {
window.addEventListener("hashchange", hashChange, false);
// Define window location variables
var windowHost = window.location.host,
windowHash = window.location.hash,
windowPath = window.location.pathname;
But I changed them to make the addEventListener
conditional on the basis of whether that method was present or not. Some research told me that the method is not available in older versions of IE (e.g. 7 in my case). Also, the IE7 debug console was identifying that as an unavailable method, so that's pretty clear. I rewrote the lines as follows, but the code is still not working:
var queue = 0;
$('document').ready(function() {
if(window.addEventListener) {
window.addEventListener("hashchange", hashChange, false);
}
else if (window.attachEvent) {
window.attachEvent("hashchange", hashchange, false);
}
// Define window location variables
var windowHost = window.location.host,
windowHash = window.location.hash,
windowPath = window.location.pathname;
The full original script can be viewed in this pastebin: http://pastebin.com/Jc9ySvrb