How does JS get the address of the iframe page before the onload event of iframe completes?

encounter this problem when doing third-party login:
the page of iframe is the authorization page of the third-party platform (QQ Weibo). After the user clicks authorization in iframe, the page of the third-party platform in
iframe will jump to the specified callback address.
my requirement is to get the parameters on the callback address on the parent page. I don"t want to wait for the callback page to load.
the current practice is to bind the onload event to iframe. (need the page to wait for the loading to complete) then get the address of iframe after the page is loaded
is there a better way to get the jump address of iframe before onload?

I tried to bind onhashchange onhaschange onpopstate to iframe and then change the hash value of iframe could not trigger these events

Jul.27,2021

unless others allow, different domain names can only meet each other, and there is an insurmountable gap between them


try binding onbeforeunload

to iframe.
Menu