How to detect iframe redirection in JavaScript? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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 - avatar
3 Answers
29th Sep 2019, 3:01 AM
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 - avatar
+ 5
I believe this is what you are seeking
27th Sep 2019, 2:03 AM
BroFar - avatar