Closing parent popup window from iframe - javascript

On domain1.com I have a link that opens a popup to domain2.com. Within the popup is an iframe, also hosted on domain2.com. From within the iframe, i am trying to close the popup window. I seem to be getting confused on how to do this. From the iframe, do I call a javascript function defined in the popup that will close the window? Can I close the window directly from the iframe?

Using this: parent.window.close(); or this: top.window.close(); you should be able to close it.

Related

get value of parent window in modal from page opened in iframe

I have a page that is opened in iframe, that page has a modal/popup in it. I want to access the parent page (opened in iframe) values, in modal using jquery or javascript. any ideas how could I do that?
I have tried it using window.parent.document but it takes me to the index page, while I want to remain inside the body of page opened in iframe. And window.parent.$('#someId:checked') gives me [prevObject: r.fn.init(1)].

How to redirect inside a modal window using javascript?

If I open a pop up window using window.showModalDialog
Doing a
document.location.href=xxx
or
window.location=xxx
or
window.location.assign(xxx)
inside that window, causes a new window to be opened.
How can I do a redirect within a modal window? Even if it works only in IE, that would be satisfactory.
Like so:
window.open("www.youraddress.com","_self")

window.close closes the postbacked child window and a copy of child window still appears

I am opening a child window using the below code:
window.showModalDialog("FileUpload.aspx", "FileUpload",
"center:yes;resizeable=yes;dialogHeight:300px;dialogWidth:600px;");
I save the file uploaded in the child window(FileUpload.aspx)in its code behind FileUpload.vb page.
Since server side code, its postbacking and opening a new browser .
After my functionality in the child window, when I close it using below code,
window.open('', '_self', '');
window.close();
it is closing the new browser opened because of postback but a copy of the same child window is still open when returning to the parent page.
I want to close all the instances of this child window.
The showModalDialog method will freeze JavaScript execution on the parent window until the dialog that it opens has closed, so we can rule out that as the reason why your second window opens. When FileUpload.aspx posts back from the server, it should work the same way as modeless aspx postbacks.
I think you should be able to get rid of the window.open() method and you should be fine.
Parent window:
window.showModalDialog("FileUpload.aspx", "FileUpload",
"center:yes;resizeable=yes;dialogHeight:300px;dialogWidth:600px;");
The Child window will call this when it's done.
window.close();

How does one open a popup window INSIDE an iframe?

Simply put, how can I open a popup window INSIDE an iframe? Whether I use window.open in the parent window or the iframe, the popup window loads on top of the parent. Is it possible to open up a new window such that it's confined to the iframe?
Thank you very much for any help.
It is not possible to open a new window so that it is confined to the iframe. Functionality similar to what you're asking for could be achieved using a JavaScript lightbox.

Pop-Up window on parent window from iFrame button

If I have a button within a iframe, how can I create a pop-up window that will appear as part of the parent window and not within the iframe window, when I press on this button, within the iframe?
Not sure that you can, this is a protection from iframes taking over a parent page. Meaning you couldn't have a floating div. You could popup a new window from the browser like normal.

Categories

Resources