Skip to content Skip to sidebar Skip to footer

Window.location Force To Update?

I'm wondering is there a way for force window.location to update? I'm on a page which uses ajax to generate results. However, the URL stays the same in the bar and so I can't grab

Solution 1:

Are you looking to update the content and URL with AJAX? Just use History API provided by HTML5 browsers.

Solution 2:

No you can't. If you don't control the page and they are not updating the URL in a way, then there is nothing you can do.

But if you have control, then it is your responsibility to either use the fragment identifier or HTML5's new history API to update the adress. But even if you use the history API, window.location won't get changed.

Update:

Not 100% sure what Google Instant page you are talking about, but if it is the "normal" Google page, then you will see that the URL updates after 1 or 2 seconds after you typed the query.

So you could add an event listener for the hashchange event and then grab the URL from window.location.

Solution 3:

Solution 4:

changing location.hash with jquery ui tabs

Add this to your current trigger. (I'm aware this is jQuery but the logic is the same)

Post a Comment for "Window.location Force To Update?"