Shervanator
Shervanator

Reputation: 477

Does the image tag src in HTML follow 302 redirects?

I'm playing with a test project using the facebook api (via omniauth) to get back a users profile image, and I get a url something like this: http://graph.facebook.com/4/picture?width=200&height=200

If you curl this url and see the headers it has a 302 redirect to: (location) https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xfa1/t1.0-1/1939620_10101266232851011_437577509_n.jpg

In most browsers they seem to follow this url, but chrome on my computer seems to have stopped following the redirect recently (im not sure if some other behaviour has changed recently though).

What is the default behaviour for browsers? Should they follow the redirect?

If you want to do a test just run this test:

#test.html

<html>
    <body>
        <img src="http://graph.facebook.com/4/picture?width=200&amp;height=200">
    </body>
</html>

Upvotes: 8

Views: 8359

Answers (1)

Shervanator
Shervanator

Reputation: 477

I seem to have figured out why this stopped working for me.. I am using a chrome plugin called Ghostery which seem to be blocking the facebook graph call: http://graph.facebook.com/4/picture?width=200&height=200

And because of that the actual image was not shown, because the redirect was never sent back to the browser..

Anyway I guess this means browsers do indeed follow redirects!

Upvotes: 11

Related Questions