How is this possible? Image URL sometimes loads a page!?
Lately I've found on a number of occasions that I've pasted the URL of an image into the Firefox address bar, but instead of the image loading, it's somehow led to a page opening - even though the URL STILL shows that it's an image and not a page?
Here's an example: https://64.media.tumblr.com/tumblr_m0p5jy7Lhh1qzfdsjo9_250.gif If I paste this GIF URL into the address bar, it often loads a page which says "tumblr" in the corner. But sometimes it just loads the image!?
Any idea what's going on here?
所有回覆 (10)
This might be because Firefox sends a generic HTTP request header and not a special image header. Some servers send an HTML page with the image in case of the former instead of the standalone image.
Thanks Cor-el. That explanation is way over my head, but at least I know there's a reason for this happening! :-)
Would you happen to know a 'solution' to this, at the user end? To prevent images loading HTML?
The HTTP request headers for this GIF file has:
- Accept: image/avif,image/webp,*/*
So there is no specific request for a GIF file (image/gif), only the generic */* that Firefox automatically extends by showing support enabled image formats like AVIF and WebP, so that might explain that you get the HTML page and not only the GIF image. If I use "Open Image in New Tab" in the right-click context menu then I only get the stand-alone image, but I can't check the accept header because I need to reload the page and then get the HTML page once again.
Thanks Cor-el. A bit too techy for my simple brain to understand but your answer is appreciated! :-)
Image hosting sites generally want to control where images are embedded and how they are viewed, so this kind of back-end switcheroo is not completely surprising.
I think a second part of the answer is what Referer header is sent with the URL. As an example, when you follow the link from your question, they know you are not requesting the image from one of their pages. After you load that page, if you right-click the image and choose Open Image in New Tab, you get the actual image.
To complete my thought, when you use right-click Save Image As..., Firefox sends the shorter image Accept header cor-el mentioned.
Yes, like I wrote above:
If I use "Open Image in New Tab" in the right-click context menu then I only get the stand-alone image, but I can't check the accept header because I need to reload the page and then get the HTML page once again.
cor-el said
Yes, like I wrote above:If I use "Open Image in New Tab" in the right-click context menu then I only get the stand-alone image, but I can't check the accept header because I need to reload the page and then get the HTML page once again.
Sorry, I missed it when I read the thread. In the Browser Console if you click the wheel and select "Show Content Messages" and turn on Requests on the filter bar, you can see the headers on that request.
As for right-clicking and selecting "Open image in a new tab" - that's how I encountered the problem in the first place.
There's a phpBB forum I visit where many people use postimages.org to share images. When I try to open one of these images in a new tab, it usually loads an HTML page.
由 MartyJames 於
MartyJames said
As for right-clicking and selecting "Open image in a new tab" - that's how I encountered the problem in the first place.
In that case, the referring site is the forum, so the image host forces you to view their navigation. But if you use Open Image in New Tab again on that site, you should get the bare image. Not that you need to -- you can right-click > Save Image As... on that page if you need to save the image.