attachURL to dhtmlsWindows

The attachURL function was not brought over to DHX7. There’s a couple ways you can work around it, using attachHTML though.

One way would be to use an AJAX call to the url of your player, and then use attachHTML to attach it to the window. I’ve found this method to be easier, but I can envision cases where this may not work, depending on the complexity of the page at the url. But it’s been solid for me with static content.

var win = new dhx.Window(...);
dhx.ajax.get("/your/url").then(function(data){
    win.attachHTML(data);
});

Another would be to use attachHTML to put an iFrame into the window, and then set the source of the iFrame to your url. There’s some extra work with this one, though, because if you end up having to apply extra CSS to the iframe and dhx window if you want the iframe to fill the window and be responsive.

var win = new dhx.Window({
    ... // your other settings here
    html: "<iframe class='responsive_iframe' src='/your/url'></iframe>
});

Here’s the CSS you’ll have to add to the page to make the iframe responsive:

.dhx_window__inner-html-content { height:100%; }
.responsive_iframe { height: 100%; width: 100%; border: 0; }
1 Like