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.
Related
Controlling browser window (top window and not popup) height and width from that window itself. I am trying to achieve this but no success till now. How I can achieve this?
Till now I tried using
window.resizeTo(weidth , height)
but it works only with child windows and not on top window.
Also I have to control address bar, menu bar etc for top window. Basically all thinks which we can control though JavaScript while opening popup, I want to do it though same window and that window is top window (not a child window).
In Short I can’t use this below code for opening popup window.
var showMyPage = function(){
url = "myPage.html";
window.open(url, "myWindow",
"toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=400,height=600")
}
And I want to achieve same result as of opening popup on clicking below link. So it is obvious that I have to control all options from myPage.html window only.
Open myPage
Found out one way to solve this by adding JavaScript code directly on link click and open new window.
<a href="myPage.html" target="_blank"
onclick="window.open(this.href,'myWindow',
'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=400,height=600');
but still if you have any other way to solve this then please let me know.
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")
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.
Is there any way to close a new tab window that was not opened using window.open();?
No. If you didn't open the window you are not supposed to close it.
Please see here: http://www.infimum.dk/HTML/JSwindows.html#ref_3_11
In order to close a specific window using the window.close() method you need a reference to that window, which you can usually get when opening a window using the window.open() method.
Another option I can see is to use global window/frame references (self, parent, opener, etc...You can see the list in the link above as well).
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.