Is there a way to display a webpage in an IFrame in haxe-js?

I only found this, but I’m not sure how to use this:
js.html.IFrameElement - Haxe 4.3.4 API

I found this, though:

var iframe = document.createElement('iframe');
iframe.setAttribute('src', "https://mysite.com");
iframe.style.width = 450 + 'px';
iframe.style.height = 200 + 'px';
document.body.appendChild(iframe);

But this seems to be generates beneath the <div id="openfl-content"/> - since the div’s default style is 100% width/height, it pushed down the iframe from viewing area of browser.

You might be able to do something like this to take the iframe outside of the normal document flow:

iframe.style.position = "absolute";

Then, you’ll need to manually position it.

1 Like

When you create an iframe dynamically using JavaScript and append it directly to document.body, it might not appear where you intend if there are conflicting CSS styles affecting its position. This can happen if the default styles of a container (openfl-content in your case) force it out of view.