This might throw an error in IE7 as .attr('href') will hand back the fully qualified URL and not actual href attribute value (nasty IE7 bug). That's why IE7 was previously excluded from this code. If you do want to include IE7 then you'll need to just take the hash value and filter out the rest of the URL.