I have an iframe in my document serving as a drop down search bar, it will show all results, and I want it so that when I click on any of those results, it loads a page in the parent window, not in the iframe. I've seen various others say that this violates the same-origin policy, but the iframe's contents come from the same directory. Is this possible? Why does
document = document.querySelector("iframe").contentWindow.document.cloneNode(true)
not work?
Asked
Active
Viewed 680 times
0

User
- 163
- 6
-
Does this answer your question? [How to force link from iframe to be opened in the parent window](https://stackoverflow.com/questions/1037839/how-to-force-link-from-iframe-to-be-opened-in-the-parent-window) – Ron Jun 13 '20 at 23:10
-
Sorry, I guess I wasn't clear, when you click on the options it actually submits a form to another page instead of opening the link. – User Jun 13 '20 at 23:32
-
Form action can be set to anything. You need to share your code, the errors, and the expected result.. until then we will only be guessing what you need help exactly with. – Ron Jun 13 '20 at 23:34
-
My code spans a few pages because of an svg embedded inside and a lot of side like js scripts and css stylesheets, but I set the target on the form to _top, and that helped thanks! – User Jun 13 '20 at 23:44