Display complicated html string (as an string attribute) on page

0
I have a string attribute which contains the complete html-code I need to display. The html code is dynamic, I have a button which make a GET request that can update the code.   The string contains stylings etc, so I think I need to display it in an IFrame. The HTML seems to be too complex to utilize the IFrame srcDoc feature. I have managed to display it (not using mendix at all) using <iframe width="800" height="600" src="embedded.html"></iframe> But I don't know how to achieve this in Mendix when I have the code in an attribute.   I have also successfully displayed the code (again outside mendix) using writeLn.  I tried implementing this in mendix by using the htmlSnippet and JavaScript snippet. But the browser console returns SyntaxError; Invalid or unexpected token
asked
1 answers
1

If you need to inject dynamic HTML into the page you will find the HTML Element in the Marketplace is probably best to use.

 

https://marketplace.mendix.com/link/component/204843

 

You could use a Call REST action to get the content, returning this as a String that you can show on a page using the HTML Element widget.

 

Be very careful doing this, as it's a potential attack vector for a malicious third party to inject code into your application pages.

 

Good luck!

answered