My website is available at http://visualise.ca/ and when you load a post by clicking a thumbnail it will loads the post within the page using ajax. When you close the post it uses this code in order to change the url back to http://visualise.ca/ without reloading the page:
$("#close").live("click", function(event) {
$("#board").fadeOut("slow");
$("#board-wrapper").slideUp("slow");
$("html,body").delay(1000).animate({scrollTop: 0}, 300);
window.location.hash = "";
window.history.pushState(null,null,site_url+"/");
return false;
});
but in IE8 it changes it back to http://visualise.ca/# instead of http://visualise.ca/. Is there a way to correct this and make sure it is changed to http://visualise.ca/ ?
Wouldn't this stop it?
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script>
$(document).ready(function() {
$(".testPhoto").click(function(event){
event.stopPropagation();
alert("do something");
return false;
});
});
</script>
<a class="testPhoto" href="#testPhoto" onclick="testPhoto">Test Photo</a>
I happen to be doing a lot of ajax history lately. I am trying my own implementation where I navigate through pages and modals and back and fourth. Making very good progress.
Since the beginning of the tests I have noticed that the root hash; ONCE CHANGED back to the initial page (where it all started) it, only loses the hash (#) if it was a BROWSER BACK button click. If I change the hash back to '', it will ALWAYS show the /# at the end.
As far as IE8 is concerned, I don't believe there is any solution but using the iFrame hack and, since I have not got around to test IE8/iframe hack yet, I cannot comment on it.
For my solution I am using a mix of hash and pure command control. I should have the final version fully tested within a couple of weeks (wishful thinking).
Besides, who cares if a hash/sharp is left at the end of the url. I NEVER LOOK AT THE URL once I hit a web site; I just look at the contents of the page. REALLY: it just hit me that the url is only important when I want to copy and paste it. Other than that, I NEVER look at it.
Anything less that IE9 will reload the page without the ending Hash#
. My suggestion is to check for IE and remove or blank out the content. If you do want the exact way, you'll have to dodge some IE Quirks.
if ( jQuery.browser.msie && ( parseInt( jQuery.browser.version ) < 9 ) ) {
window.location = 'http://visualise.ca";
document.execCommand( 'stop' );
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With