Is it possible to detect if an image has been loaded via:
<img src="image.jpg"/>
Versus in the address bar or linked to directly via:
<a href="image.jpg">Image</a>
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, in general it is not.
The browser will issue the exact same request for both.
When the browser parses the HTML (first thing it gets), each additional resource (JavaScript, CSS, image and other linked files) will be requested separately. Browsers do not add information about where they got the reference from – so it is not possible to tell from the request whether it was directly on the address bar or from a reference on an HTML page.
You could query the logs to see if the request is all on its own or if a request to the HTML page (and possibly other resources) have been done around the same time. This is not fool proof (think about the multiple levels of caching we have on the web).