Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove iframe from parent page using a function inside the iframe?

I have an iframe I put on a page using a bookmarklet, I want this iframe to close itself when I navigate to a certain page inside this iframe.

How to do that using JavaScript?

Note: iframe and container page are in different domains.

like image 815
Amr Elgarhy Avatar asked Jan 22 '23 22:01

Amr Elgarhy


1 Answers

As far as I know you cannot remove the element from the DOM from the iframe's container unless it's the same domain if I'm understanding you properly due to cross-domain security policies.

If this were possible you could infiltrate bank sites and all, it'd be a mess.

like image 73
meder omuraliev Avatar answered May 17 '23 13:05

meder omuraliev