Jump to content

Question mark after .js and .css files?


nloding

Recommended Posts

So I was looking over Facebook's website to see how they implemented a few things, and all the links are littered with numbers following the file extension.  Some are understandable, for normal PHP uses (searches, profile id, whatever).  Some are bizarre, such as these:

 

<img src="http://static.ak.facebook.com/images/global_menu_space.gif?12:37897" align="top" />
<script type="text/javascript" src="http://static.ak.facebook.com/js/vector.js?12:61586"></script>
<link rel="stylesheet" href="http://static.ak.facebook.com/css/attachments.css?12:59060" type="text/css"/>

 

What is the purpose of having that info after the filename?  I'm lost, I can't find anything about this!  I've seen it everywhere too, like in the Wordpress javascript includes.  This is the only time I've seen it on an img tag though.

Link to comment
Share on other sites

there are 2 ways they can be using those.  The first is just to put some extra info into their server logs about from which page the request came from.  The extra stuff on the end of the .gif will cause no graphic loading problem so it can be a simple way to get extra info in your logs.

 

The other way they could be using that could be termed : When is a .css file not a .css file? The answer to that is when you use the .htaccess file in apache to make an arbitrary file extension of your choice now be parsed and executed as a .php file!  For instance you could make a '.cat' file run as a .php file, or even the .css files.  That way the .css file could process url parameters, set or retrieve cookies, and access databases.  It would still have to return a file in .css format, but parts of that .css file could be altered based on info gathered server side, like maybe the current users page style preferences.

Link to comment
Share on other sites

<img src="http://static.ak.facebook.com/images/global_menu_space.gif?11:11111" align="top" />
<img src="http://static.ak.facebook.com/images/global_menu_space.gif?12:37897" align="top" />

How is that useful for caching fenway? For instance, wouldn't the 2 images above be treated as 2 different images by caches only because the numbers after the '.gif?' are different even though the graphics are the same? Wouldn't that cause the images to not be cached?

Link to comment
Share on other sites

<img src="http://static.ak.facebook.com/images/global_menu_space.gif?11:11111" align="top" />
<img src="http://static.ak.facebook.com/images/global_menu_space.gif?12:37897" align="top" />

How is that useful for caching fenway? For instance, wouldn't the 2 images above be treated as 2 different images by caches only because the numbers after the '.gif?' are different even though the graphics are the same? Wouldn't that cause the images to not be cached?

Sorry, I meant useful for preventing caching... obviously, in this case, that's not what they want, but I've appended timestamp to src tags regularly.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.