tags:

views:

13

answers:

1

Lets say I have a URL (http://www.example.com/something). Is the following scenario somehow possible?

A) The user visits the URL directly and a standard page with markup, js, etc. is shown. B) The user embeds the same URL in an image tag and the URL is served only as an image.

A: 

This can be accomplished in any CGI program by checking the HTTP_REFERRER header.

A) In the case of the URL being entered directly the referrer header should be empty. Or if the user came from a link on another site then it will have the URL of that site.

B) When the resource is loaded from an <img...> HTML tag then the referrer header should contain the URL of the page that contains the image.

So by checking the contents of that header your response handler can take different actions.

maerics
Alright that sounds good but unfortunately if somebody posts the link somewhere the referrer will not be empty.