Jquery/javascript detect and capture page refresh events?

You can't change the querystring...without the browser actually leaving the page and fetching a new one (kind of killing the point of AJAX).

You can't change the querystring...without the browser actually leaving the page and fetching a new one (kind of killing the point of AJAX). You can go to a hash though, like this: example.com/#data=blah&stuff=bleh In your script just set the window.location. Hash, e.g. : window.location.

Hash = "data=blah$stuff=bleh"; When your page loads, you'll need to actually use the hash...for example: using it as the data parameter to do the same AJAX call you made before.

I was actually thinking of having the page ACTUALLY redirect to the query string url on page refreshes but leaving the URL the same in other cases. However, your technique is probably a better solution, I'll try it out! – Razor Storm Jul 21 '10 at 0:02 I tried it and it works wonderfully.

However, I just realized one problem. Since hashes are meant to be used for inpage navigation, entering a hashed url into the location bar doesn't actually cause the page to refresh. Is there a way to force a refresh when javascript detects this change?

– Razor Storm Jul 21 '10 at 0:08 @Razor - I'm curious...if you want the page to refresh, why are you using AJAX? – Nick Craver? Jul 21 '10 at 0:14 @Nick, no I don't want the page to refresh when the AJAX request occurs.

What I mean is this. When the AJAX request occurs, the page does not refresh, then it changes the url to www.example.com/#data=blah. This part works perfectly.

\n Now say your friend sends you a link "www.example.com/#data=bloh". And you put this into your url bar and press enter. If you are already on www.example.com, your page won't actually go to your friend's page, and instead will simply stay at the same page you were previously on since hashes doesn't cause a page refresh.

– Razor Storm Jul 21 '10 at 0:17 1 @Razor - Ah in that case yes there is an onhashchange event...but it's not cross-browser supported. But...there's a plugin to normalize it so it works everywhere: benalman. Com/projects/jquery-hashchange-plugin – Nick Craver?

Jul 21 '10 at 0:22.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions