Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to expire a .js and .ccs page?

Status
Not open for further replies.

MrMajik

IS-IT--Management
Apr 2, 2002
267
I have a need to expire .js and .ccs pages because when I modify an existing page the user needs to refresh the site to see the changes. If I could expire these two types of pages or assign them a date from the past then they would expire the next time a person visits the site.

Any ideas?

Thank you.

MrMajik

Everything should be made as simple as possible, but not simpler
--Albert Einstein


 
Hi mate,

The easiest way to do this is to call the js or css page with a random query string.

If you are using an server-side language then this is simple and can be done automatically, otherwise you would really need to change the query string manually everytime you change the file.

Code:
file.css?453435343

Hope this helps

Wullie


The pessimist complains about the wind. The optimist expects it to change. The leader adjusts the sails. - John Maxwell
 
Wullie,

I do not know the meaning of your example. Can you explain it?

Thank you.

MrMajik

Everything should be made as simple as possible, but not simpler
--Albert Einstein


 
Wullie means append a random query string to the end of uopr css link declaration:
Code:
<link rel="stylesheet" type="text/css" href="file.css?453435343" />

The css file will completely ignore the query string. The easiest way is to add in a timestamp from the server, so it looks unique each time.

Makes cacheing useless though, so it will drain bandwidth and slow the site down.

<marc> i wonder what will happen if i press this...[ul][li]please tell us if our suggestion has helped[/li][li]need some help? faq581-3339[/li][/ul]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top