473,386 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

IE does not reload css or js file...

Hello,

I'm working on an ASP.net 2.0 web project using VS 2005. I'm on my laptop
running IIS on WinXP SP2 with all the latest updates. The Default web site
is set to run on .net 2.0 My project uses a master page.

I have two separate issues that I think are related.

First, I can't figure out why changes to my CSS don't load when I start the
project. The css is in the master page. The CSS loads, but only the last
version I hit F5 for. I always have to hit F5 to see the changes. I set
the IE option to Check for newer versions of stored pages every time I visit
the webpage. Yes I closed all instances of IE and even rebooted for good
measure. No luck.

Second, I can't get javascript to work when it's being called using the src
attribute. I use

<script type="text/javascript" src="test.js" ></script>

test.js is in the same folder as test.aspx, which calls it. I stripped
everything out of the files - even the code-behind file. All that's in the
..js file is an alert function. The only thing on the web form is a button
that calls the function using OnClientClick. It works if I put the function
in the web form so I know javascript works. I had a brief moment of success
when it worked - I thought - but it was having the same problem as the CSS -
It would not show the latest changes without hitting F5. I would make the
message "aaaaa" and start the project, hit F5 and see "aaaaa". I'd stop the
project, change the message to "bbbbb", start the project and still see
"aaaaa" until I hit F5 and see "bbbbb".

This is why I think the CSS and javascript problems are related.

Does anyone know why this is happening?

Thanks.

Matthew Wells
Ma***********@FirstByte.net
Jun 27 '08 #1
8 3906
Try adding a Global.asax file and on it's Application_BeginRequest method
add the following:

HttpContext.Current.Response.Expires = 0;
HttpContext.Current.Response.ExpiresAbsolute = DateTime.Now.AddDays(- 2);
HttpContext.Current.Response.CacheControl = "private";
HttpContext.Current.Response.AddHeader("pragma", "no-cache");

That should prevent your browser from caching any files.

I'm pretty sure it will also affect the .js and .css files when you load
them from an ASPX page, but if it doesn't you can just rename your .js and
..css files to .aspx and it will be fine.

Hope that helps,
Fernando L Rodriguez, MCP

"Matthew Wells" <Ma***********@FirstByte.netwrote in message
news:CI******************************@comcast.com. ..
Hello,

I'm working on an ASP.net 2.0 web project using VS 2005. I'm on my laptop
running IIS on WinXP SP2 with all the latest updates. The Default web
site is set to run on .net 2.0 My project uses a master page.

I have two separate issues that I think are related.

First, I can't figure out why changes to my CSS don't load when I start
the project. The css is in the master page. The CSS loads, but only the
last version I hit F5 for. I always have to hit F5 to see the changes. I
set the IE option to Check for newer versions of stored pages every time I
visit the webpage. Yes I closed all instances of IE and even rebooted for
good measure. No luck.

Second, I can't get javascript to work when it's being called using the
src attribute. I use

<script type="text/javascript" src="test.js" ></script>

test.js is in the same folder as test.aspx, which calls it. I stripped
everything out of the files - even the code-behind file. All that's in
the .js file is an alert function. The only thing on the web form is a
button that calls the function using OnClientClick. It works if I put the
function in the web form so I know javascript works. I had a brief moment
of success when it worked - I thought - but it was having the same problem
as the CSS - It would not show the latest changes without hitting F5. I
would make the message "aaaaa" and start the project, hit F5 and see
"aaaaa". I'd stop the project, change the message to "bbbbb", start the
project and still see "aaaaa" until I hit F5 and see "bbbbb".

This is why I think the CSS and javascript problems are related.

Does anyone know why this is happening?

Thanks.

Matthew Wells
Ma***********@FirstByte.net


Jun 27 '08 #2
This is just down to caching. If your JS and CSS files are not dynamic, then
when on your site, it shouldn't be an issue...

However, when you run the project from VS, if the files are not there, then
simply press and hold your CTRL key whilst you press the refresh button (or
press CTRL-F5 whilst browser is focussed).

This will get you the latest version.

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
"Matthew Wells"
Hello,

I'm working on an ASP.net 2.0 web project using VS 2005. I'm on my laptop
running IIS on WinXP SP2 with all the latest updates. The Default web
site is set to run on .net 2.0 My project uses a master page.

I have two separate issues that I think are related.

First, I can't figure out why changes to my CSS don't load when I start
the project. The css is in the master page. The CSS loads, but only the
last version I hit F5 for. I always have to hit F5 to see the changes. I
set the IE option to Check for newer versions of stored pages every time I
visit the webpage. Yes I closed all instances of IE and even rebooted for
good measure. No luck.

Second, I can't get javascript to work when it's being called using the
src attribute. I use

<script type="text/javascript" src="test.js" ></script>

test.js is in the same folder as test.aspx, which calls it. I stripped
everything out of the files - even the code-behind file. All that's in
the .js file is an alert function. The only thing on the web form is a
button that calls the function using OnClientClick. It works if I put the
function in the web form so I know javascript works. I had a brief moment
of success when it worked - I thought - but it was having the same problem
as the CSS - It would not show the latest changes without hitting F5. I
would make the message "aaaaa" and start the project, hit F5 and see
"aaaaa". I'd stop the project, change the message to "bbbbb", start the
project and still see "aaaaa" until I hit F5 and see "bbbbb".

This is why I think the CSS and javascript problems are related.

Does anyone know why this is happening?

Thanks.

Matthew Wells
Ma***********@FirstByte.net


Jun 27 '08 #3
The files are there and as I said everything works after I hit F5 or Ctrl
F5. I've also started the project using Ctrl F5. I'm going to try the
suggestion in the first reply, but I shouldn't have to go through that.
I'll let you know.

Thanks.
"David" <da*****************@revilloc.REMOVETHIS.comwrot e in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
This is just down to caching. If your JS and CSS files are not dynamic,
then when on your site, it shouldn't be an issue...

However, when you run the project from VS, if the files are not there,
then simply press and hold your CTRL key whilst you press the refresh
button (or press CTRL-F5 whilst browser is focussed).

This will get you the latest version.

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
"Matthew Wells"
>Hello,

I'm working on an ASP.net 2.0 web project using VS 2005. I'm on my
laptop running IIS on WinXP SP2 with all the latest updates. The Default
web site is set to run on .net 2.0 My project uses a master page.

I have two separate issues that I think are related.

First, I can't figure out why changes to my CSS don't load when I start
the project. The css is in the master page. The CSS loads, but only the
last version I hit F5 for. I always have to hit F5 to see the changes.
I set the IE option to Check for newer versions of stored pages every
time I visit the webpage. Yes I closed all instances of IE and even
rebooted for good measure. No luck.

Second, I can't get javascript to work when it's being called using the
src attribute. I use

<script type="text/javascript" src="test.js" ></script>

test.js is in the same folder as test.aspx, which calls it. I stripped
everything out of the files - even the code-behind file. All that's in
the .js file is an alert function. The only thing on the web form is a
button that calls the function using OnClientClick. It works if I put
the function in the web form so I know javascript works. I had a brief
moment of success when it worked - I thought - but it was having the same
problem as the CSS - It would not show the latest changes without hitting
F5. I would make the message "aaaaa" and start the project, hit F5 and
see "aaaaa". I'd stop the project, change the message to "bbbbb", start
the project and still see "aaaaa" until I hit F5 and see "bbbbb".

This is why I think the CSS and javascript problems are related.

Does anyone know why this is happening?

Thanks.

Matthew Wells
Ma***********@FirstByte.net



Jun 27 '08 #4
No, not starting the project with ctrl-f5, but just press ctrl-f5 in your
browser to force it to download the latest (uncached) files.
--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
"Matthew Wells"
The files are there and as I said everything works after I hit F5 or Ctrl
F5. I've also started the project using Ctrl F5. I'm going to try the
suggestion in the first reply, but I shouldn't have to go through that.
I'll let you know.

Thanks.
"David" <da*****************@revilloc.REMOVETHIS.comwrot e in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>This is just down to caching. If your JS and CSS files are not dynamic,
then when on your site, it shouldn't be an issue...

However, when you run the project from VS, if the files are not there,
then simply press and hold your CTRL key whilst you press the refresh
button (or press CTRL-F5 whilst browser is focussed).

This will get you the latest version.

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
"Matthew Wells"
>>Hello,

I'm working on an ASP.net 2.0 web project using VS 2005. I'm on my
laptop running IIS on WinXP SP2 with all the latest updates. The
Default web site is set to run on .net 2.0 My project uses a master
page.

I have two separate issues that I think are related.

First, I can't figure out why changes to my CSS don't load when I start
the project. The css is in the master page. The CSS loads, but only
the last version I hit F5 for. I always have to hit F5 to see the
changes. I set the IE option to Check for newer versions of stored pages
every time I visit the webpage. Yes I closed all instances of IE and
even rebooted for good measure. No luck.

Second, I can't get javascript to work when it's being called using the
src attribute. I use

<script type="text/javascript" src="test.js" ></script>

test.js is in the same folder as test.aspx, which calls it. I stripped
everything out of the files - even the code-behind file. All that's in
the .js file is an alert function. The only thing on the web form is a
button that calls the function using OnClientClick. It works if I put
the function in the web form so I know javascript works. I had a brief
moment of success when it worked - I thought - but it was having the
same problem as the CSS - It would not show the latest changes without
hitting F5. I would make the message "aaaaa" and start the project, hit
F5 and see "aaaaa". I'd stop the project, change the message to
"bbbbb", start the project and still see "aaaaa" until I hit F5 and see
"bbbbb".

This is why I think the CSS and javascript problems are related.

Does anyone know why this is happening?

Thanks.

Matthew Wells
Ma***********@FirstByte.net




Jun 27 '08 #5
a f5 in IE will not reload css or javascript files that are caches. you
must delete the cache.

switch to firefox and the developer extension, you can flip a setting to
reload javascript and css while debugging. if you must use IE, then load
its dev toolbar, at least it has a button to delete cache.

-- bruce (sqlwork.com)
David wrote:
No, not starting the project with ctrl-f5, but just press ctrl-f5 in your
browser to force it to download the latest (uncached) files.

Jun 27 '08 #6
I believe his problem is not on his browser's side but on his server's
side. IIS will cache the css stylesheet and will not always detect
when it's changed (i.e. if the file is programmatically modified
instead of copied/deleted/created).

To disable CSS caching (and most of the caching mechanisms, be
warned...), on the server, create the following registry key :

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Servic es\HTTP\Parameters
\UriEnableCache

...and set it to 0 (zero).

This works on IIS 7, don't know about other versions but it's worth a
try.

Don't know if it will help with the js problem, though.

Warning : always make a backup of the registry before editing, be
extra careful if it's a production server, etc, you know the drill.

HTH,

Michel


On 3 mai, 19:12, "Matthew Wells" <Matthew.We...@FirstByte.netwrote:
Hello,

I'm working on an ASP.net 2.0 web project using VS 2005. *I'm on my laptop
running IIS on WinXP SP2 with all the latest updates. *The Default web site
is set to run on .net 2.0 * My project uses a master page.

I have two separate issues that I think are related.

First, I can't figure out why changes to my CSS don't load when I start the
project. *The css is in the master page. *The CSS loads, but only the last
version I hit F5 for. *I always have to hit F5 to see the changes. *I set
the IE option to Check for newer versions of stored pages every time I visit
the webpage. *Yes I closed all instances of IE and even rebooted for good
measure. *No luck.

Second, I can't get javascript to work when it's being called using the src
attribute. *I use

<script type="text/javascript" src="test.js" ></script>

test.js is in the same folder as test.aspx, which calls it. *I stripped
everything out of the files - even the code-behind file. *All that's in the
.js file is an alert function. *The only thing on the web form is a button
that calls the function using OnClientClick. *It works if I put the function
in the web form so I know javascript works. *I had a brief moment of success
when it worked - I thought - but it was having the same problem as the CSS-
It would not show the latest changes without hitting F5. *I would make the
message "aaaaa" and start the project, hit F5 and see "aaaaa". *I'd stopthe
project, change the message to "bbbbb", start the project and still see
"aaaaa" until I hit F5 and see "bbbbb".

This is why I think the CSS and javascript problems are related.

Does anyone know why this is happening?

Thanks.

Matthew Wells
Matthew.We...@FirstByte.net
Jun 27 '08 #7
This one worked at first. I remmed out the lines and it failed. Then I
unremmed them and it still didn't work. Still can't get it to refresh
without manually hitting F5.
"Fernando Rodriguez, MCP" <fr***********@hotmail.comwrote in message
news:48**********************@roadrunner.com...
Try adding a Global.asax file and on it's Application_BeginRequest method
add the following:

HttpContext.Current.Response.Expires = 0;
HttpContext.Current.Response.ExpiresAbsolute = DateTime.Now.AddDays(-
2);
HttpContext.Current.Response.CacheControl = "private";
HttpContext.Current.Response.AddHeader("pragma", "no-cache");

That should prevent your browser from caching any files.

I'm pretty sure it will also affect the .js and .css files when you load
them from an ASPX page, but if it doesn't you can just rename your .js and
.css files to .aspx and it will be fine.

Hope that helps,
Fernando L Rodriguez, MCP

"Matthew Wells" <Ma***********@FirstByte.netwrote in message
news:CI******************************@comcast.com. ..
>Hello,

I'm working on an ASP.net 2.0 web project using VS 2005. I'm on my
laptop running IIS on WinXP SP2 with all the latest updates. The Default
web site is set to run on .net 2.0 My project uses a master page.

I have two separate issues that I think are related.

First, I can't figure out why changes to my CSS don't load when I start
the project. The css is in the master page. The CSS loads, but only the
last version I hit F5 for. I always have to hit F5 to see the changes.
I set the IE option to Check for newer versions of stored pages every
time I visit the webpage. Yes I closed all instances of IE and even
rebooted for good measure. No luck.

Second, I can't get javascript to work when it's being called using the
src attribute. I use

<script type="text/javascript" src="test.js" ></script>

test.js is in the same folder as test.aspx, which calls it. I stripped
everything out of the files - even the code-behind file. All that's in
the .js file is an alert function. The only thing on the web form is a
button that calls the function using OnClientClick. It works if I put
the function in the web form so I know javascript works. I had a brief
moment of success when it worked - I thought - but it was having the same
problem as the CSS - It would not show the latest changes without hitting
F5. I would make the message "aaaaa" and start the project, hit F5 and
see "aaaaa". I'd stop the project, change the message to "bbbbb", start
the project and still see "aaaaa" until I hit F5 and see "bbbbb".

This is why I think the CSS and javascript problems are related.

Does anyone know why this is happening?

Thanks.

Matthew Wells
Ma***********@FirstByte.net



Jun 27 '08 #8
This one seemed to wokrk!!!! Thanks!!!! There is still a timing issue with
javascript, but I'll put that one in a separate post.

Matthew Wells
Ma***********@FirstByte.net
<fd******@hotmail.comwrote in message
news:80**********************************@2g2000hs n.googlegroups.com...
I believe his problem is not on his browser's side but on his server's
side. IIS will cache the css stylesheet and will not always detect
when it's changed (i.e. if the file is programmatically modified
instead of copied/deleted/created).

To disable CSS caching (and most of the caching mechanisms, be
warned...), on the server, create the following registry key :

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Servic es\HTTP\Parameters
\UriEnableCache

....and set it to 0 (zero).

This works on IIS 7, don't know about other versions but it's worth a
try.

Don't know if it will help with the js problem, though.

Warning : always make a backup of the registry before editing, be
extra careful if it's a production server, etc, you know the drill.

HTH,

Michel


On 3 mai, 19:12, "Matthew Wells" <Matthew.We...@FirstByte.netwrote:
Hello,

I'm working on an ASP.net 2.0 web project using VS 2005. I'm on my laptop
running IIS on WinXP SP2 with all the latest updates. The Default web site
is set to run on .net 2.0 My project uses a master page.

I have two separate issues that I think are related.

First, I can't figure out why changes to my CSS don't load when I start
the
project. The css is in the master page. The CSS loads, but only the last
version I hit F5 for. I always have to hit F5 to see the changes. I set
the IE option to Check for newer versions of stored pages every time I
visit
the webpage. Yes I closed all instances of IE and even rebooted for good
measure. No luck.

Second, I can't get javascript to work when it's being called using the
src
attribute. I use

<script type="text/javascript" src="test.js" ></script>

test.js is in the same folder as test.aspx, which calls it. I stripped
everything out of the files - even the code-behind file. All that's in the
.js file is an alert function. The only thing on the web form is a button
that calls the function using OnClientClick. It works if I put the
function
in the web form so I know javascript works. I had a brief moment of
success
when it worked - I thought - but it was having the same problem as the
CSS -
It would not show the latest changes without hitting F5. I would make the
message "aaaaa" and start the project, hit F5 and see "aaaaa". I'd stop
the
project, change the message to "bbbbb", start the project and still see
"aaaaa" until I hit F5 and see "bbbbb".

This is why I think the CSS and javascript problems are related.

Does anyone know why this is happening?

Thanks.

Matthew Wells
Matthew.We...@FirstByte.net

Jun 27 '08 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Q | last post by:
Hello, I have the following problem. Using php I have composed a file which add to an html file text typed into text-field. Problem is that I can see new conntent of html file only after...
4
by: STEPHEN GOODE | last post by:
I have a php script that dynamically creates images, reusing image files on the server to save space and clutter. The problem is described in the steps below: 1. User clicks on a button. 2....
4
by: Warrick Wilson | last post by:
I've got a web page that uses frames. One of the frames loads an HTML page that redirects to a 3rd HTML page. This third page loads a Java applet - ProScroll.class - that runs a "news ticker"...
66
by: Ellinghaus, Lance | last post by:
> > Other surprises: Deprecating reload() >Reload doesn't work the way most people think >it does: if you've got any references to the old module, >they stay around. They aren't replaced. ...
1
by: zdhiu | last post by:
Hi javascript gurus, I have a simple html file (simple.html) with javascript. In html page there is sentence from variable defined in .js file (myFirst.js). Once I reload another .js file...
3
by: sentinel | last post by:
Hi all, I'm trying to reload a frame from a pop-up, but really cannot figure this out. Within my index.htm file, I make a link to call a pop-up frame with a javascript function that calls the...
4
by: Lonnie Princehouse | last post by:
So, it turns out that reload() fails if the module being reloaded isn't in sys.path. Maybe it could fall back to module.__file__ if the module isn't found in sys.path?? .... or reload could...
3
by: Stef Mientki | last post by:
hello, I've a graphical application (wxPython), where the code in the main GUI loop is given below. 1 JAL_Loaded = False 2 while len(App_Running) 0: 3 if JALsPy_globals.State...
2
by: RB | last post by:
Hi there, I'm having a problem with an ASP.NET/VB.NET Control I am writing. The control is a simple gallery control, which shows a set of thumbnails (using a DataList), and a main image of the...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.