开发者

how to detect image redirect in js

right now the jsp code will create html like below

<a href="xxxxxx">
 <img width="143" height="143" s开发者_StackOverflowrc="http://yyyyyyyy.jpg">
</a>

while loading the page the yyyyyyyy.jpg will be redirect to xxxxx.jpg

Since the yyyyyyyy.jpg is provided by other service provider i dont know whether one image will be redirect or not .

My question is : is there any way i can do in js , to detect a image redirected or not or can i test all url in when document ready to know whether one image url will be redirected.

Thanks


If the URL does not have matching domain, protocol and port, then you can't see if it redirects (because of Same Origin Policy) with JavaScript only, unless it explicitly allows you to via CORS.

You could use a server side language to detect it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜