2

Maybe it has been asked somewhere, but I am trying to find my question and I am not able to find any answer.

Here's my question:

I am developing a web application and because of some major JavaScript issue in IE8, I need the user to run "Google Chrome Frame" (To enhance the speed of the web page). I was impressed that my page was working 100% fine until the time it was supposed to be refreshing and it wasn't refreshing (Ajax getJSON request using jQuery).

The problem is that it does not request the new data on the server, but it looks like it goes in the cache for the answer of that request and then return the same thing every time instead of new data.

I don't really know how to explain it, but it just does not update. Also, when I hit F5 on the page, it does not update the page, it keeps the old page (even if I hit CTRL-F5 or any other normal force-refresh button). To have the changes, I actually need to close the browser (IE8) and re-open it so it can take the new changes.

Is there anyone who know how I could disable the cache when Google Chrome Frame is active?

The meta tag I use is :

<meta http-equiv="expires" content="0">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache, must-revalidate"> 
<META HTTP-EQUIV="X-UA-COMPATIBLE" CONTENT="CHROME=1">

If you need any more details, don't hesitate to ask.

Nordes
  • 2,493
  • 2
  • 21
  • 30
  • Are you sure the problem is with GCF, since jQuery also does it's own caching – Yi Jiang Oct 01 '10 at 13:48
  • yes, because if I add an alert in my html page (in the header) saying "hello world", it show the first time I load the page. When i edit my HTML file and change hello world to hello you and save the file. I hit the refresh button in IE8 and it still says "Hello world". – Nordes Oct 01 '10 at 13:50

1 Answers1

0

An old CGI trick would have been to encode the date as a parameter onto the request so the URL changes with each request. That generally stops any caching on the URL.

So you'd have url?01102010134532 if you encoded date and time down to miliseconds.

If I understand your requirement properly, you'd have to do this in JQuery / JS and would need to modify the parameter on the URL after each AJAX request was made, so the next one would be different to the previous

Paul Hadfield
  • 6,088
  • 2
  • 35
  • 56
  • I know that trick, you also need to do that in action script (flash) when you do AJAX requests. I know that will work for the Ajax request (like using the tick time), but if my JS file calling my service is updated it won't actually update, because it will still be in cache. – Nordes Oct 01 '10 at 13:55
  • The operations should be in memory, so the cache shouldn't come into it. Consider if you had a function mapped to a click event and each time you clicked it added one to the counter and displayed it. If what you are saying is true, the alert would also contain the same value (never increased) as it was always taken from cache. I've never seen that happen before in any situation. – Paul Hadfield Oct 01 '10 at 14:11
  • You were right about the cache in AJAX (jquery)... I had to put $(document).ready(function() { $.ajaxSetup({ cache: false }); }); just to make sure that the cache by default was disabled. But it's weird that it was working in all browsers except [IE + GCF]. Anyway, thank you. – Nordes Oct 04 '10 at 13:06