tags:

views:

84

answers:

6

I feel dumb for not knowing this, but I see a lot of links in web pages and instead of this:

<a href="http://foo.com/"&gt;

...they use this:

<a href="http://foo.com/?src=bar.com"&gt;

Now I understand that the ?src= is telling something that this referral is coming from bar.com, but I don't understand why this needs to be called out explicitly. Can anyone shed some light on it for me? Is this something I need to include in my program generated links?

EDIT: Ok, sorry, I'm not being clear enough. I understand the GET syntax with a question mark and parameters separated by ampersands. I'm wondering what's this special src parameter? Why would one site link to another and tack an src parameter on the end even though there's no indication that the destination site uses this normally.

For example, on this page hover your mouse over the screenshot. The link URL is http://moms4mom.com/?src=stackexchangesites

But moms4mom.com is our site. Passing the src parameter does nothing, so why include it?

A: 

The second is a dynamic link, it's a URL that another language(like ASP and PHP) interpret as something to do, like in those Google URLs, but i never used this site(foo.com), then i don't much things about this parameter.

Nathan Campos
I understand the GET syntax, but I'm wondering is there some standard about the src parameter.
Scott Whitlock
Scott: I added a bit to my answer - but no, there is nothing special about "src" as a field name.
Reed Copsey
Thanks, now i see ypur edit.
Nathan Campos
A: 

The part after the ? is the query string. Different sites use it for different things, and it is usually used for passing information to the server side code for that URL, but can also be used in javascript.

For more info see Query String

Corey Sunwold
It can also be used in client-side javascript.
Brian
@Brian: I forgot about that. Thank you. Editted.
Corey Sunwold
A: 

Depending on how the site processes its URL, you may or may not need to include the ?... information.

This is passed to the website, and the server can process it just like form input. Some sites require this - and build their navigation off a single page, using nothing but the "extra" stuff passed afterwards. If you're generating a link to a site like that, it will be required.

In other cases, this is just used to pass extra, unrequired info (such as advertising, tracking info, etc)... In those cases, you can leave it off.

Unfortunately, there's no way to know without trying whether you can remove the "extra" bits from the URL.


After reading some of your comments - I'll also say:

There is nothing special about the "src" field in a query string. The server is free to use it any way it wishes. Unless you know specific info about the server, you cannot assume it can be left out.

Reed Copsey
+1  A: 

There is no standard to the src parameter. Each site has its own and it's usually up to the site that gets the link to define how it wants to read it (as usually it's that site that's going to pay for the click).

devoured elysium
+2  A: 

The reason (I do it) is that popular analytics tools sometimes make it easier to filter on query strings than referrers.

cheez
+2  A: 

There are a few reasons that the src is being used explicitly. But in general, it is easier and more reliable to trust a query string to determine referer[sic] than it is to trust the referer, since the latter is often broken, deliberately or not. On the other hand, browsers almost never break the query string in a url, since this, unlike referers, is pretty important for pages to function. Besides, a referer is often done without any deliberate action on the part of the site doing the refering, which some users dislike.

Brian