Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

URL change without page reload in IE

Tags:

jquery

ajax

I want to avoid page load but the URL should change and should be same in all browser. I am trying to use Ajax post with URL change. I have searched and found it is possible using # or .pushstates().

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

I tried by using .pushstates() but it doesn't work in IE < 10. I don't want to use # in the URL. Is there any way to achieve this in IE?

like image 224
user1357737 Avatar asked Jun 29 '12 06:06

user1357737


People also ask

How do I modify the URL without reloading the page?

Method 2: Adding a new state with pushState() Method: The pushState() method is used to add a new history entry with the properties passed as parameters. This will change the current URL to the new state given without reloading the page.

How can I change URL without reloading page in next JS?

Shallow routing allows you to change the URL without running data fetching methods again, that includes getServerSideProps , getStaticProps , and getInitialProps . You'll receive the updated pathname and the query via the router object (added by useRouter or withRouter ), without losing state.

Can JavaScript change URL?

In fact, JavaScript provides the location object, a part of the window object, which allows you to perform different URL-related operations.

How do I refresh my current URL?

reload() method reloads the current URL, like the Refresh button. location. reload(); It has an optional parameter forceReload , which defaults to false when forceReload is true .


1 Answers

I'm afraid that the answer is just a plain no, there is no way to achieve this in IE.

You will have to accept using the hash if you want to identify different resources your application with the URL without reloading the page.

Note: the semantic of the hash is precisely to identify different resources within the same page, so if you don't reload the page, using the hash might actually be a good thing.

like image 128
Samuel Rossille Avatar answered Sep 18 '22 18:09

Samuel Rossille