Window .attachURL

The window widget used to have .attachURL method, what happened to it, and how to go about attaching the context to the window from the file?

Yes, they dropped the .attachURL() function from the window. But you can use the .attachHTML() function to add an iframe with the src set to the page you want to load.

win.attachHTML("<iframe style='height:100%; width:100%; border:0px;' src='/path/to/your/page.html' />");

However, there’s a bit of extra work to be done, because the content div inside the window defaults to height 0 and expands based on its content. So you’ll need to apply some CSS to your window, and also tweak the CSS for the window content div.

<style>
    .window_iframe .dhx_window__inner-html-content { height: 100%; }
</style>

let window = new dhx.Window({
    title: "Window",
    css: "window_iframe"
});

If the window will always only contain the iframe, you can add it directly into the window when it’s initialized and not have the extra .attachHTML() function call, like so:

let window = new dhx.Window({
    title: "Window",
    css: "window_iframe",
    html: "<iframe style='height:100%; width:100%; border:0px;' src='/path/to/your/page.html' />"
});
1 Like

Thank you, it was very helpfull