This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes How to prevent the browser from executing the old version of js file... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to prevent the browser from executing the old version of js file... " Watch "How to prevent the browser from executing the old version of js file... " New topic
Author

How to prevent the browser from executing the old version of js file...

Sudheesh
Greenhorn

Joined: Sep 22, 2005
Posts: 11
Dear sirs,


I have a JSP page that includes a javascript file as given below,
<script type="text/javascript" src="../scripts/validation.js"></script>
Some times modification is needed in this included script file. After the modification, when I load the JSP page in the browser,
the old copy of the script file, which was not modified is getting executed. by the browser.

I would like to know whether any options are availabe in javascript to prevent the browser from executing the old copy that has already downloaded to the temperary interner folder(from caching)and use the modified version available with the new response...

Thank you,
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Only way to do this is to rename the .js file.

Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61761
    
  67

"Snowhite India",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
Forum Bartender
[ September 22, 2005: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61761
    
  67

Adjust your browser's cache settings. Sometimes IE needs to be refreshed a few times to update the file.
Jayesh Lalwani
Ranch Hand

Joined: Nov 05, 2004
Posts: 502
If you change your set IE setting to check for newer pages on every visit, then that will solve the problem. Although, this might slow down your pages a little bit.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to prevent the browser from executing the old version of js file...