I am using backbone.js and pushstate. In IE9, it degrades to using the hashtag and AJAX requests work just fine. The issue I have is with refreshing the page. My links are in the following format:
/a_username/a_collection_id
in IE9 if I am on:
/me/collection1
and I click on the AJAX link:
/me/collection2
I get this:
/me/collection1#me/collection2
When I refresh the page however, because the server knows nothing after the hashtag, I am brought back to /me/collection1 instead of the intended /me/collection2.
What is a workaround for this problem in browsers that don't have pushstate?
You could do a check on initial page load and see if there is a hashtag and then do a redirection. Something similar to this:
window.onload = function(){
if (window.location.hash){
window.location.replace("...root url..." + window.location.hash);
}
};
Not the cleanest solution as it will cause a redirect whenever someone lands on a link with a hashtag but it will give you the result you're looking for.