Link to home
Start Free TrialLog in
Avatar of dyarosh
dyarosh

asked on

Internet Explorer 8.0 Cache Problem

I am having a bizare problem.  I am running Windows XP and have IIS 6.0 installed and running.  This is my delvelopment environment.  I have a website that I am having a problem with caching.  I have a web page that is referencing a .js file.  The problem I'm having is that the .js file is loaded in a cache somewhere and is not being updated as I make changes to it.  

Scenario
================
I started out with a simple function in my .js file (test.js) that contains the following:
function AssignPSIDs()
{
   alert("In AssignPSIDs");
}

I have a webpage that uses XSL and XML.  The XSL  has a reference to my test.js file.  In my XSL, where i make the call to AssignPSIDs, I get the alert.

Now I go in and change the function to do what I really want.  When I run the webpage and click the button, I still get the alert -- it is not executing my new code.  If I look at the .js file, the new code is there.  However, if I debug the webpage using InterDev 6.0, the test.js script shows in the list of files loaded for the process but when I open it, it has the old script info, ie. the alert.

I am using IE 8.0 and have cleared my cache using Internet Options -> General ->Browising History -> Delete.  I have exited and restarted the browser.  Nothing seems to work.  

Any ideas?
Avatar of cfEngineers
cfEngineers

as a test try
<script src="test.js?test=1" />
if that works, then you are right about the caching.
and you can use some js to append new date and time as a ?nocahe='+new Date().getTime();
this will append a timestamp

Good Luck,
Ernie
Restarting IIS will also do the trick.
Avatar of dyarosh

ASKER

Tried restarting IIS and even restarted the whole PC and still the problem is there.
Avatar of dyarosh

ASKER

The problem may reside within IIS.  I turned on the option to display ASP errors instead of the standard error that my IIS was setup with for my application and the ASP errors are not being displayed, only the standard error.  I have restarted IIS and even rebooted the machine several times and I still can't get it to work.  Any other thoughts?
Include these in your HTML page

<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<META HTTP-EQUIV="EXPIRES" CONTENT="0">

From http://www.i18nguy.com/markup/metatags.html#expires

Avatar of dyarosh

ASKER

Discovered the problem but still don't know why.  Turns out I am using localhost in my url (this is on a development machine).  I have a hosts file with a valid entry for localhost.  I don't know where localhost is resolving but if I use my machine name instead of localhost, everything works fine.  If anyone has any ideas they would be appreciated.  
Copy the HOSTS file to "HOSTS_OLD", then remove all un-commented lines from the HOSTS file.
ASKER CERTIFIED SOLUTION
Avatar of dyarosh
dyarosh

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dyarosh

ASKER

No further response from the experts.