Follow redirects for HTTP image request, client side

You know this link:

http://media.photobucket.com/image/graphics/PennilessTeacher/Graphics/monster.jpg?o=8 

redirects to this link:

 http://i1133.photobucket.com/albums/m581/PennilessTeacher/Graphics/monster.jpg 

Well, let's say I have:

 <img src='http://media.photobucket.com/image/graphics/PennilessTeacher/Graphics/monster.jpg?o=8' width='blah' height = 'blah'/> 

A request to the image URL will be redirected. I want to know the URL end . So in this case it will be http://i1133.photobucket.com/albums/m581/PennilessTeacher/Graphics/monster.jpg .

Earlier, I asked about getting the status code of a request for a cross-domain image, which seems impossible without the server side of the script that performs the http request.

Server-side scripts are out of the question here. I need the request to be processed on the client side, as some sites that the image element will link to should point to some specific cookies that are on the client side, and I obviously can not help myself, because they are intended for completely different domain. If that makes sense ...

Any client language will work. I know it or not.

Suggestions of people? Or am I completely screwed?

+4
source share
2 answers

It is not possible to obtain this information using client-side scripts. The only information in the DOM is the originally requested URI.

(If it were possible, then the information could have been leaked, for example, if http://example.com/me redirected to http://example.com/users/username and displayed the Alice username on Bob’s Malory website (which launched a website with <img src="http://example.com/me"> on it when Alice visited this site ... or maybe he can redirect to http://cdn.example.com/alices/private/content/protected/by/time/limited/key/h4io3foiu32if390f490 and allow Malory to access Alice's private content).

+2
source

I'm not sure, but can this be the solution or even what you are asking ... suppose you know the url ... create a server side file (.php in my case) that takes the url from the client side (using ajax or something else) and uses curl to get the image site ... then find the img tag with id = fullSizedImage and get src from it ... as I said, I'm not sure if you asking ...

0
source

All Articles