Reputation: 167
Good evening,
I have an issue with inserting an iframe or object in a popup created like that:
//Version 1
function fShowPop()
{
var oPopup = window.createPopup();
oPopup.document.body.innerHTML = '<iframe id="ifrmPop" src="<myLink>"></iframe>';
oPopup.show(15, 150,200, 200, document.body);
}
//Version 2
function fShowPop()
{
var oPopup = window.createPopup();
oPopup.document.body.innerHTML = '<object data="<myLink>" type="text/html"></object>';
oPopup.show(15, 150,200, 200, document.body);
}
So the result is a blank square... And the page source is not affected.
<html><body></body></html>
If I use document.write the source is affected but it stay blank.
Thanks beforehand!
Upvotes: 1
Views: 290
Reputation: 167
Ok I solved it:
//Version 3
function fShowPop()
{
var oPopup = window.createPopup();
oPopup.document.body.innerHTML = '<a target="_blank" href="<mylink>"><img title="" src="../../pics/mypic.gif" border="0"></a>';
oPopup.show(15, 150,200, 200, document.body);
}
There is a strange behavior with the popup, but at least it show well.
Thank you!
EDIT: finally it does not work...forget about it. Window.open seems the only way to achieve it...
Upvotes: 0
Reputation: 2998
There are 2 Possible Problems:
The window.createPopup()
method is no longer supported. It used to be an Internet-Explorer-only function, but now it's not supported in any browser at all.
The iframe
has no width
or height
attributes set, so it'll be zero size. However, modern browsers have a default iframe size of 300 pixels by 150 pixels.
Since the most likely reason is no browser support, check out http://www.quirksmode.org/js/popup.html, which is an alternative.
Upvotes: 1