With javascript, how do you get final result URL after 302 redirect on img src?

前端 未结 5 499
花落未央
花落未央 2020-12-04 02:30

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

5条回答
  •  渐次进展
    2020-12-04 02:54

    based on http://jsfiddle.net/jfriend00/Zp4zG, this snippets works in Firefox 17.0:

    alert(document.getElementById("testImage").baseURI)
    

    It doesn't work in Chrome. Not tested anything else-

提交回复
热议问题