使用javascript,如何在img src上重定向302后获得最终结果网址? [英] With javascript, how do you get final result URL after 302 redirect on img src?

查看:2025
本文介绍了使用javascript,如何在img src上重定向302后获得最终结果网址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果页面中有一个img标签,其显示的最终图像出现在302重定向之后,是否有一种方法可以通过javascript获得重定向后的最终到达网址?在img.src上使用javascript只是获取第一个URL(页面中的内容),而不是重定向到。

If there is an img tag in a page whose final image it displays comes after a 302 redirect, is there a way with javascript to obtain what that final URL is after the redirect? Using javascript on img.src just gets the first URL (what's in the page), not what it was redirected to.

这是一个jsfiddle插图: http://jsfiddle.net/jfriend00/Zp4zG/

Here's a jsfiddle illustration: http://jsfiddle.net/jfriend00/Zp4zG/

推荐答案

不,这是不可能的。 src 是一个属性,它不会更改。

No, this is not possible. src is an attribute and it does not change.

这篇关于使用javascript,如何在img src上重定向302后获得最终结果网址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆