Go Back  HTML Forums - Free Webmaster Forums and Help Forums > WEBSITE DEVELOPMENT > Client Side Scripting
User Name:
Password:
 

Reply
Thread Tools   Display Modes
  View First Unread
 
Old 09-24-2005, 02:12 PM
  #1
Endeavor88
Swordman (Level 9)
 
Endeavor88's Avatar
 
Join Date: Nov 2004
Location: Los Angeles
Posts: 87
iTrader: (0)
Endeavor88 is on a distinguished road
Ajax Chat

I have recently been working on an Ajax chat program. The way it works is that I send data in XML format for sending messages, and I retreive XML data for retrieving messages. Anyways I sent an interval to retreive messages every 5 seconds(default; or the user can set it). I tested it in firefox and it works perfectly. But in IE, it loads all the messages once, and then never updates. You can still send messages in IE, but the user will never know it.
Here's the site:
http://endeavor.aspfreeserver.com/ubiquitous/chat.php

Someone please tell me why the script does not work in Internet Explorer.
Endeavor88 is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 09-25-2005, 01:56 AM
  #2
Endeavor88
Swordman (Level 9)
 
Endeavor88's Avatar
 
Join Date: Nov 2004
Location: Los Angeles
Posts: 87
iTrader: (0)
Endeavor88 is on a distinguished road
I think the reason is that Internet Explorer cached the xmlhttprequest results. If you saw my other page, http://endeavor.aspfreeserver.com/ubiquitous/ , then you can see what I mean. You can double click on any word to receive its definition. In Internet Explorer, if you double click on the same word twice, IE will not request the same definition again. Instead, it will load what it previously download via the xmlhttprequest. However, firefox reloads the definition on each double click. It appears that IE caches the xmlhttprequest results and saves it for the session, but firefox does not save it.

Is there a way to put a expiration date on the xml data or the xmlhttprequest so that Internet Explorer will download new data for each request?
Endeavor88 is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 09-25-2005, 07:07 PM
  #3
Endeavor88
Swordman (Level 9)
 
Endeavor88's Avatar
 
Join Date: Nov 2004
Location: Los Angeles
Posts: 87
iTrader: (0)
Endeavor88 is on a distinguished road

I was correct. I need to add a header for "Cache-control: no-cache" in php.
Endeavor88 is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 09-26-2005, 09:32 PM
  #4
Jon Hanlon
Super Guru (Moderator)
 
Jon Hanlon's Avatar
 
Join Date: Jul 2001
Location: Sydney, Australia
Posts: 1,842
iTrader: (0)
Jon Hanlon will become famous soon enough
It's best not to rely on cache control -- none of it works 100%.
Internet Explorer will cache the responses if the parameters are the same.
eg. &from=sinbad&body=sailing

What I do is add a unique id which is never accessed but constantly changing:
+ "&uid=" + (new Date()).getTime()

This will force a unique response for each browser.
__________________
Jon Hanlon
Jon Hanlon is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 09-26-2005, 10:03 PM
  #5
Endeavor88
Swordman (Level 9)
 
Endeavor88's Avatar
 
Join Date: Nov 2004
Location: Los Angeles
Posts: 87
iTrader: (0)
Endeavor88 is on a distinguished road
Thanks, I'll try that.
Endeavor88 is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 09-26-2005, 10:12 PM
  #6
Endeavor88
Swordman (Level 9)
 
Endeavor88's Avatar
 
Join Date: Nov 2004
Location: Los Angeles
Posts: 87
iTrader: (0)
Endeavor88 is on a distinguished road
It seems to work both ways:
I can add some php code:
PHP Code:
header("Cache-Control: no-cache"); 
or I can add an extra parameter that is constantly changing,
"&uid=" + (new Date()).getTime()

The 2nd method works with POSTing and GETing. I can use the time when posting messages so that I know when the message was posted. However, I don't see a way to use it when receiving new messages from the server.

How hazardous is using cache control? Take also into account that some browsers might not even support the xmlhttprequest, and therefore cache control would not matter anymore with those browsers.
Endeavor88 is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 09-27-2005, 06:37 PM
  #7
Jon Hanlon
Super Guru (Moderator)
 
Jon Hanlon's Avatar
 
Join Date: Jul 2001
Location: Sydney, Australia
Posts: 1,842
iTrader: (0)
Jon Hanlon will become famous soon enough
Here's Microsoft on the subject:
http://support.microsoft.com/default...;en-us;Q234067
__________________
Jon Hanlon
Jon Hanlon is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote

Reply
KEEP TABS
SPONSORS
 
Boxedart
 
 


 
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
  
 
 
 



 
  POSTING RULES
 
 
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Thread Tools
Display Modes

Forum Jump

 

All times are GMT -5. The time now is 04:31 AM.

   

Mascot team created by Drawshop.com

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.

Server Monitoring by ENIACmonitor 0.01
HTMLforums.com © Big Resources, Inc. Web Design by BoxedArt.com
vRewrite 1.5 beta SEOed URLs completed by Tech Help Forum and Chalo Na.