views:

60

answers:

4

I have a CGI application written in C. When I POST (delete data) to the cgi app from the html form, the action is correctly executed on the server but the page does not refresh after the POST. It does flicker, but displays the non-updated page. I then have to hit the browsers refresh to see the correct updated html page (showing data has been removed).

Is this the web server? Javascript? or just a browser setting? (I am using GoAhead web server, cgi app in C, javascript, html and Fire Fox.)

Any help is appreciated.

+1  A: 

It's your browser cache that is playing tricks on you.

Check the HTTP headers you get when GETting (or POSTing) the page to see if there are anything about cache, if there is it's your webserver that is causing the cache otherwise it's the browser. Try with a different browser, or make the webserver send the page with a negative expiration date.

adamse
Will a negative expiration date guarantee a fresh page?
Tommy
Looking at the headers, when there is an image it displays "cache-Control: no-cache and Pragma: no-cache" Doesn't have this information for html though
Tommy
In my experience a negative expiration date will cause the page to be expired immediately, i.e. it won't be cached in the browser. But I think this might be considered a hack, I would look for the cause of the problem first and see if it can be fixed.
adamse
I hear you. Which cache is it saved in....memory, disk, or offline cache
Tommy
That I have no idea about. I would guess your browser keeps the cache of the most recent pages in memory. I would advise you to test with different browsers and also check out "fuzzy lollopop"'s answer.
adamse
+1  A: 

Are you sure you're returning an updated page in response to the POST?

Rob
The updated page is in the local directory on the client....it then is displayed correctly (but I have to manually hit the browser refresh) I expect directly after the POST the new page to be displayed.
Tommy
+1  A: 

In order to be sure what is happening, you need to sniff the local network (using Wireshark).

Wrieshark shows you the traffic and also can filter a specific stream.

After you capture you can understand what exactly was sent to the server and what was the respond.

eyalm
+1  A: 

If you are using Firefox you need to install the Firebug plugin and it will show you if your pages are being cached or being retrieved from the server correctly in the "net" panel.

fuzzy lollipop