numbers that append href links to stylesheets and javascript files

They have: 426 posts

Joined: Feb 2005

I keep noticing that some websites have numbers appended to the end of the refering to a stylesheet or refering to a javascript file.

example:
print.css?1232495530" media="print" rel="stylesheet" type="text/css" />

ga.js?1232495530" type="text/javascript">

This obviously looks dynamic but what is this for - i can a stylesheet be dynamic and how can a javascript file receive what looks like parametres in the URL?

Any explanation appreciated.

greg's picture

He has: 1,581 posts

Joined: Nov 2005

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

As the link probably explains it is to get your browser to grab a fresh copy instead of using a cached version.

The numbers at the ends are usually just random numbers so each load of the page (if it isn't cached itself LOL) will most likely grab a fresh copy from the server.

-Greg

He has: 5 posts

Joined: Jan 2009

1. Browser is expected to request for the js or css script instead of caching it when a new session is loaded, allowing for newer versions of scripts to be loaded.
2. The javascript 'may' be used to point to a specific state in an AJAX page.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.