Reputation:
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'/>
The request to the image URL will be redirected. I want to know the end URL. So in this case, it would be http://i1133.photobucket.com/albums/m581/PennilessTeacher/Graphics/monster.jpg
.
I previously asked a question about fetching the status code of a cross domain image request, which seems to be impossible without a server side script doing the http
request.
Server side scripts are out of the question here. I need the request to be processed on the client's side, as some of the sites the image element will be pointing to require some specific cookies that sit on the client side, which I obviously cannot help myself to as they're for a completely different domain. If that makes any sense...
Any client side language will do. Whether I know it or not.
Suggestions people? Or am I totally screwed?
Upvotes: 4
Views: 1420
Reputation: 170
i'm not sure but can this be a solution or even is it 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(with ajax or whatever) and uses curl to obtain the image site...then, find the img tag with the id=fullSizedImage and get the src of it...as i said i'm not sure whether is this you are asking...
Upvotes: 0
Reputation: 943614
There is no way to get that information using client side scripting. The only information in the DOM is the originally requested URI.
(If it was possible then information could be leaked. e.g. if http://example.com/me
redirected to http://example.com/users/username
and expose Alice's username on Bob's site to Malory (who ran the website with <img src="http://example.com/me">
on it when Alice visited that site … or perhaps it might redirect to http://cdn.example.com/alices/private/content/protected/by/time/limited/key/h4io3foiu32if390f490
and let Malory get access to Alice's private content).
Upvotes: 2