I'm using dhtmlmodal for creating modal windows.
Modal window is created inside a "iframe".
My problem:
I open a modal window, that window is redirected to another page in a different server and I try to close the window with javascript.
But dhtml modal closes the window with:
parent.vmodal.hide()
Due to the window in the iframe is from a different host, it say "permission denied".
Also windows.close() doesn't work with a iframe.
My question:
How can I close an iframe from inside the iframe?
- If the document is from a different domain. There is no way to close this iframe form the document inside the iframe? This shouldn’t be a problem of security, no? if possible, how can I do it?
- From the main window, is possible to read a field of the iframe (in a different domain). Suppose no, right? If possible, i can use a timer for searching a filed in the iframe and close the window. But don't know how to read a filed in the frame from the main window.
- If the document is from a different domain. There is no way to close this iframe form the document inside the iframe? This shouldn’t be a problem of security, no? if possible, how can I do it?
Once again: it is not possible. Full stop.
Originally Posted by FelipeGar
- From the main window, is possible to read a field of the iframe (in a different domain). Suppose no, right?
That is possible. But only with a help of a server-side proxy application.
Originally Posted by FelipeGar
If possible, i can use a timer for searching a filed in the iframe and close the window.
No. Reading a file is one thing. Closing a window is another thing.
Let me tell you why it is not possible. If both documents (the parent document and "iframed" document) belong to the same domain, there is a reciprocal javascript reference between them. If they belong to different domains, there is no javascript relationship between them, so that there is no reference to which you can command: "you there! close yourself!". If no reference, no action is possible.
Bookmarks