WCM Placeholder tag – Issues with htmlencode=”true”


When content author publishes the content with single quotes or double quotes or special char in name or title causing Javascript errors (or HTML is getting break ).

We have enabled default or global htmlencode setting like below as

ISC (WAS Admin) console à Resources àResources Environment Providers àWCM_WCMConfigService , change or set “cmpnt.htmlEncodeDefault” to “true” .
NOTE: Once this setting is enabled you don’t need add the “htmlencode=true” explicitly on the tags
By setting this to true , the reserved HTML characters in the source is converted into character entities. For example, '<' is converted to '&lt;'  and ‘(single quote) to &apos ...etc. and it is working as expected for the “property tags” ..etc .
But output of the placeholder tags are not getting encoded and causing presentation break when menu or navigators uses the place holder tags like below.
<li id='[Placeholder tag="name"]'><a href="[Placeholder tag="href"]">[Placeholder tag="name"]</a></li>

Or

<script>
                document.getElementById(‘[Placeholder tag="name"]’);
</script>

HTML or Javascript break in above example if name contains single quote.
 After doing some research found that by setting  “htmlencode=true” explicitly on the placeholder tag made the output encoded.
This supposed to fix in Portal V7 but looks like it is still a issue and placeholder tags encoding is working as expected only when you set this option explicitly.

Resources:
  

No comments:

Post a Comment