+ 6

How to detect iframe redirection in JavaScript?

I am making a sort of login system which uses an iframe, and once the user has logged in the iframe redirects itself (not the whole page, just the iframe). My question is, would it be possible to detect when the iframe has been redirected, and to what URL has it redirected to?

27th Sep 2019, 1:54 AM
Rowsej
Rowsej - avatar
3 Answers
29th Sep 2019, 3:01 AM
Rowsej
Rowsej - avatar
+ 7
BroFarOps Thanks for the link, but it’s not quite. That one, when after the iframe has refreshed/loaded, changes the page URL. I’m looking for something that detects when it redirects (like that link answered), but also what URL does it redirect to? Because if the user entered wrong login details, then it would be still on the same page.
27th Sep 2019, 2:20 AM
Rowsej
Rowsej - avatar
+ 5
I believe this is what you are seeking https://stackoverflow.com/a/10301551/7218253
27th Sep 2019, 2:03 AM
BroFar
BroFar - avatar