suma suma - 4 years ago 284
jQuery Question

Removing hash from URL

After removing hash from URL using

window.location.hash=''
page getting reloaded in firefox.

EDIT

Example:

wwww.Mysite.come/#page=1


On a click of button I am removing hash value using following code

window.location.hash=''


After removing the hash page is getting reloaded in firefox.

I don't want to reload page I just want to remove hash from URL

How to fix it?

Answer Source

From https://developer.mozilla.org/en/DOM/window.location:

Examples

Whenever a property of the location object is modified, a document will be loaded using the URL as if window.location.assign() had been called with the modified URL.

This question I think addresses what you want using jQuery:

Change hash without reload in jquery

Other related questions:

Change the URL in the browser without loading the new page using JavaScript

How to remove the hash from window.location with Javascript without page refresh?

How can I change Firefox window.location.hash without creating a page reload?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download