views:

324

answers:

5

I was just viewing stackoverflow page source and I have a few simple questions;

1) What is the purpose of this? DO search engines see this or something else?

<link rel="search" type="application/opensearchdescription+xml" title="Stack Overflow" href="/opensearch.xml">

2) ?v=3731 Why is this added to the end of some javascript and stylesheet files, is it to prevent the browser from caching these items? And if I am correct, then why would you not want this, I would think they wouldn't change often

<script type="text/javascript" src="/content/js/master.js?v=3731"></script>

3) What kind of file is this rel="canonical"

<link rel="canonical" href="http://stackoverflow.com/questions/1180651/php-array-and-foreach"&gt;

4) What is this, my guess is maybe if you put in the page URL into something like google reader it would find this file maybe?

<link rel="alternate" type="application/atom+xml" title="Feed for question 'php array and `foreach?'" href="/feeds/question/1180651">`
+3  A: 

I bet number two is to let the browser cache the items forever, but then be able to update the number when the file actually changes on their end so the browser will grab the newest version.

Edit: For three, read http://www.mattcutts.com/blog/canonical-link-tag/

Steve Losh
+20  A: 
  1. This is to enable a site to be used as a built in search within a browser. Similar to the way wikipedia can be used from the top right search bar in firefox. More info can be found here

  2. This is to make use of browser caching, which is likely to be aggressively set with the content headers. By appending v=?, it ensures that the latest js file is used when a revision is made.

  3. Canonical is used to specify the preferred version of a url, if that content is duplicated elsewhere.

  4. Yes this is used to indicate that the url can serve an rss/atom feed that can be fed through a reader such as google reader.

Aurelio Tinio
BTW. The Reason it is V is probably for 'Version'. Meaning that it will only change with new versions, so the browser can cache it really easily.
Chacha102
Which Steve already said... I need to read more answers before commenting.
Chacha102
+9  A: 

number 4 is so that when you go to a page in FF or IE7+ the little RSS icon at the top of your browser lights up and you can add that feed to the browser's built-in feed reader

Jason
sorry I see it now in firefox in the addressbar, I generally use chrome, that is really neat I didn't know of this feature, many sites must not use it, thanks!
jasondavis
+7  A: 

(1) is what enables browsers like Firefox to add Stack Overflow as a search provider. Try it: visit Stack Overflow with Firefox. If you look at the "search box" in the upper right hand corner, you'll see a kind of glow on the drop-down selector for which engine to search. If you click it, it will give you the option to add Stack Overflow to the list.

Avdi
Never knew how that was done. +1
MitMaro
thats really cool thanks, and I added it because searching stackoverflow is something I do daily
jasondavis
+3  A: 
  1. Allows for browsers such as FireFox (possibly others) to use Stack Overflow as a built-in search. If you're using FireFox, look to the right of the address bar, there's a search bar. 'opensearchdescription' lets the SO search be automagically added to that.
  2. ?v=#### means "version", allowing your browser to cache the current version and automatically update when the SO version of the javascript changes.
  3. 'rel="canonical"' is used by search engines, if there's more than one way to address a page. One becomes the official, or canonical, URL, which allows search engines to ignore what appears to be duplicate pages.
  4. This allows RSS readers to find the feed for a given website, basically making it easier to add to your RSS reader.
lacqui