Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

How to insert <script> tag form dialog to page ?

Avatar

Level 2

Hi 

    I am trying to get the script tag from dialog to page using context as "html", but its not supporting the <script> tag. Is there is any other way to include <script> tag from dialog to page ?.     

${inheritedPageProperties.dtmheader @ context='html'}

Thank you.

1 Accepted Solution

Avatar

Correct answer by
Level 10

By Default sightly will do XSS protection and context="html" will Use this in case you want to output HTML, Removes markup that may contain XSS risks

Use ${inheritedPageProperties.dtmheader @ context='unsafe'}

Wondering why you are allowing your author to insert scripts from dialog box?

View solution in original post

3 Replies

Avatar

Correct answer by
Level 10

By Default sightly will do XSS protection and context="html" will Use this in case you want to output HTML, Removes markup that may contain XSS risks

Use ${inheritedPageProperties.dtmheader @ context='unsafe'}

Wondering why you are allowing your author to insert scripts from dialog box?

Avatar

Level 8

I agree with edubey on this.  You really shouldn't be letting content editors add script tags to markup.

It also looks like you're wanting them to add a DTM header - why not utilize the Cloud Service Configurations to do this for you?  If that's not an option, you could simply add a field for the script URL and only render the <script> tag if it's supplied.

Avatar

Level 2

Thank you very much :) . Edubey , Leeasling 

As there is no  proper Cloud Service Configurations for DTM & AEM, i am inserting DTM header and footer tag in page property dialog. So that author can easily take script tag from DTM and change based on environment.