The callback address cannot be opened in the parent window after the ifram embedded third party login is successful.

< H1 > problem description < / H1 > < H2 > existing A page with embedded B page third party login page ( B page address splicing urcallback=A page address ) < / H2 >

1 normal mode (not logged in), log in to page B in page An and enter the account password. After success, return to page A (the entire parent window is page A)
2 problem mode (page B is already logged in), open page A, and the embedded page B determines that you have already logged in, so jump back to page A directly, but then page A will appear in the location of page B embedded in iframe on page An and page A will be opened. ( that is, it jumps to page A directly in iframe, but does not open page An in the parent window )
so please ask how to solve this problem?

Apr.07,2021

if (login == true && window != window.top) {
   window.top.location.replace(window.location);
}

use js operation, communication between iframe, to modify A page, or A page to listen for iframe address jump?

I have not heard of the method of directly using the cross-domain page in iframe to modify the main page.


window.top.location.
if you cross-domain, you can consider listening to hash and Message

Menu