views:

405

answers:

2

I have a Flex application that uses a rich interface. The user can create data and have it instantly show up in a list of data that they have created. The data is stored in a MySQL database using HTTPService POST requests from the Flex application and PHP forms to handle the data on the server side. For sake of explanation, let's say the data is simply a question. In both Safari and Firefox, the data instantly shows up as it is supposed to as it is added to the database and then called to reload. However, when using IE the data IS added to the database, but it doesn't show up right away as it should. Sometimes it requires that the user empty the cache and other times they may need to quit IE and restart it. However, all times it IS added to the database. The PHP form uses a simple MySQL SELECT statement to get the data from the database.

Are there known issues with IE caching this data for a length of time? Is there any way to make it not do that?

+1  A: 

I've been using a tool called Fiddler lately, which lets you watch the web traffic on your system, and even modify the requests and responses. In your case, you'll want to install it, and set it up as a reverse proxy so that your flex app communicates through it to the PHP layer.

Once that's set up, you can more easily track what's happening with your data. (I found a JSON plugin for mine that lets me view the JSON structure as a tree, but it natively supports an XML view)

Once you understand and explain the traffic a bit better, I might be able to help you out. It doesn't sound like a 304 HTTP problem. Confirm that the data is being returned to IE.

Glenn
I do know that it is being returned because it will show up sometimes after a couple of refreshes or a restart of IE. I know it is being added to the database the first time because I am watching it in MySQL. Would adding a timestamp to my PHP form call help to fix this?
joshholat
You need something to confirm that the data is being fetched by IE when you expect it to be. You need to find out what is happening that requires IE to be restarted. It sounds like a cache issue, but installing something like Fiddler will help you see the differences between browsers. But you can also try looking at the webserver logs and comparing the responses between different browsers. You need to try to eliminate parts that could be the problem. DB, PHP, Web server, Browser, Flex....
Glenn
It's almost certainly a cache-header problem; you need to make sure that your HTML pages are being delivered with proper headers that indicate that cached copies may not be reused.Internet Explorer may cache and reuse the response to a GET request if the server does not send any headers prohibiting caching. Workarounds: Either use the POST method, a random query string, or (best) configure the server to send proper cache directives. Note: Using a non-random query string alone is not enough to prevent caching. See www.fiddler2.com/redir/?id=httpperf
EricLaw -MSFT-
A: 

IE is notorious for caching stuff like ajax requests. General rule of thumb - on important requests that shouldnt be cached, make sure the pragma header is set to no-cache....

so in php call:

    header("Pragma: no-cache");

before content is rendered / returned to the browser. A more in depth interpretation can be found here: http://thecodeabode.blogspot.com/2010/10/cache-busting-ajax-requests-in-ie.html

Ben