I have developed a AJAX search component to query a Google Search Appliance. It makes an AJAX call to a php script that grabs XML from the GSA and encodes it as JSON and sends it back to the browser. From there, the jquery template plugin does the rest. That process works as it should.
However, when I navigate away from the search page (e.g., click on a result link) and later wish to return to the search results, IE and chrome do not retain the search results and your position on the page, while FF, Opera, and Safari do retain the the AJAX content appended to the DOM and your position on the pae. In IE and Chrome, it is essentially hitting back and seeing a blank page w/ no results.
Is there a reason why the browsers behave differently? (some browsers show appended content when you go back to the page, some don’t)
Is there a way to easy way to fix this without some type of session or state or storage?
Thanks
How i would do it is basically when you hit search your change the location of the page without actually redirecting ( ex: http://myurl.com/search.html#mysearchtext(url encoded))
Then you do your search.
On the onload event of your page you check for any #xxxxx in the url, and if one exists make the search.
It serves 2 purpose :
– This way your back action will work always 😛
– This way you can link your search results directly.