Show HTML while glide.ui.escape_text is set to true

General Add comments

During a Hardening period with one of our customers I had to set some security properties to ‘true’. This will harden the security on the platform. Setting some properties to ‘true’ did cause some issues. For example, the glide.ui.escape_text property. While this property is set to ‘true’, HTML will be shown as a string when a message (sys_ui_message) contains HTML or a script include is returning HTML. This is not the expected result. Therefore I have found two different solutions to solve this issue. To solve the messages issue, it is possible to remove the html tags within the messages and place these tags in the corresponding macro, ui page or dynamic content (at the place where you’ll be showing the content).

Since we are showing a string instead of HTML, the second solution is to transform this string into HTML. First you will have to create two variables. One for (1)the HTML string value and one to (2)pass this value to. In this case, it is the hidden inputfield (1)“#ka_url” and the (2)“allKAItems” div. Set the “allKAItems” variable as innerHTML equal to the variable you have made for “#ka_url”. InnerHTML is important, because it sets or returns content to HTML. This solves the whole problem!

//This is what we return from the Script Include called portalFunctions (Function KAItems)
var html = '

' + html;

I hope this was useful info! Please drop a comment if you would like more information!

Leave a Reply