How to get final jQuery / AJAX url

When I run $.geteither .loadin jQuery, the query seems to be fine for 302 redirection and gives me the final answer that I can use in the callback for $.getor which connects to the thiselement for .load.

Although I obviously have the source URL, since I control the string entered as the first argument to $.getor .load(it would also be useful if I could get this directly in the callback to simplify) how to access the final url (after the redirect) in the callback?

I suspect this will be in the XMLHttpRequest object for which I found the specification .

+3
source share
1 answer
I'm not sure (and Googling didn't get me anywhere), but what about this unorthodox solution? var hiddenIframe = $ (''). attr ({style: 'display: none;'}). appendTo ('body'); hiddenIframe.attr ({src: 'http://www.direct-me.com'}); hiddenIframe.load (function () {Notification (hiddenIframe.attr ('SRC'));}); It basically just makes a hidden iframe, and then goes to your url, and the download callback * should * indicate the final url.

It seems you cannot. You can get the original src, but then you cannot due to security problems.

+1
source

Source: https://habr.com/ru/post/1751205/


All Articles