webhelp.head.script converts &,<,> to & < >
Posted: Thu Apr 26, 2018 1:46 am
I'm using Oxygen 20 classic webhelp.
My company has asked me to add a widget from a customer support company called ZenDesk. The widget is javascript and looks like this (I've replaced my company name with "company"):
<!-- Start of company Zendesk Widget script -->
<script>/*<![CDATA[*/window.zEmbed||function(e,n){var t,o,d,s,i,a=[],r=document.createElement("iframe");window.zEmbed=function(){a.push(arguments)},window.zE=window.zE||window.zEmbed,r.src="javascript:false",r.title="",r.role="presentation",(r.frameElement||r).style.cssText="display: none",d=document.getElementsByTagName("script"),d=d[d.length-1],d.parentNode.insertBefore(r,d),s=r.contentWindow,i=s.document;try{o=i}catch(e){t=document.domain,r.src='javascript:var d=document.open();d.domain="'+t+'";void(0);',o=i}o.open()._l=function(){var e=this.createElement("script");t&&(this.domain=t),e.id="js-iframe-async",e.src="https://assets.zendesk.com/embeddable_f ... his.t=+new Date,this.zendeskHost="company.zendesk.com",this.zEQueue=a,this.body.appendChild(e)},o.write('<body onload="document._l();">'),o.close()}("https://assets.zendesk.com/embeddable_f ... endesk.com");
/*]]>*/</script>
<!-- End of company Zendesk Widget script -->
I tried embedding this script directly into an HTML file that Oxygen generates, and it works - a little "Support" bubble appears on the bottom right. To automatically add this to all my output HTML files, I copied the script to a file and pointed to it from my transformation scenario using the webhelp.head.script parameter.
It didn't work...and it seems like the reason is that it converts these characters:
& --> &
< --> <
> --> >
For some reason, this causes the widget to not work. When I go into one of the generated HTML files and replace the "&", "<", and ">" with the original characters, then it works fine.
Is there a way to have Oxygen *not* convert these characters?
I tried a little javascript test to see if those character replacements interfere with normal Javascript, and it seems like they do:
=== This outputs "YES" ===
<html>
<head>
<script type="text/javascript">
if (1==1 && 2==2) {
document.write('YES');
}
</script>
</head>
</html>
=== This outputs nothing ===
<html>
<head>
<script type="text/javascript">
if (1==1 && 2==2) {
document.write('YES');
}
</script>
</head>
</html><html>
<head>
<script type="text/javascript">
if (1==1 && 2==2) {
document.write('YES');
}
</script>
</head>
</html>
My company has asked me to add a widget from a customer support company called ZenDesk. The widget is javascript and looks like this (I've replaced my company name with "company"):
<!-- Start of company Zendesk Widget script -->
<script>/*<![CDATA[*/window.zEmbed||function(e,n){var t,o,d,s,i,a=[],r=document.createElement("iframe");window.zEmbed=function(){a.push(arguments)},window.zE=window.zE||window.zEmbed,r.src="javascript:false",r.title="",r.role="presentation",(r.frameElement||r).style.cssText="display: none",d=document.getElementsByTagName("script"),d=d[d.length-1],d.parentNode.insertBefore(r,d),s=r.contentWindow,i=s.document;try{o=i}catch(e){t=document.domain,r.src='javascript:var d=document.open();d.domain="'+t+'";void(0);',o=i}o.open()._l=function(){var e=this.createElement("script");t&&(this.domain=t),e.id="js-iframe-async",e.src="https://assets.zendesk.com/embeddable_f ... his.t=+new Date,this.zendeskHost="company.zendesk.com",this.zEQueue=a,this.body.appendChild(e)},o.write('<body onload="document._l();">'),o.close()}("https://assets.zendesk.com/embeddable_f ... endesk.com");
/*]]>*/</script>
<!-- End of company Zendesk Widget script -->
I tried embedding this script directly into an HTML file that Oxygen generates, and it works - a little "Support" bubble appears on the bottom right. To automatically add this to all my output HTML files, I copied the script to a file and pointed to it from my transformation scenario using the webhelp.head.script parameter.
It didn't work...and it seems like the reason is that it converts these characters:
& --> &
< --> <
> --> >
For some reason, this causes the widget to not work. When I go into one of the generated HTML files and replace the "&", "<", and ">" with the original characters, then it works fine.
Is there a way to have Oxygen *not* convert these characters?
I tried a little javascript test to see if those character replacements interfere with normal Javascript, and it seems like they do:
=== This outputs "YES" ===
<html>
<head>
<script type="text/javascript">
if (1==1 && 2==2) {
document.write('YES');
}
</script>
</head>
</html>
=== This outputs nothing ===
<html>
<head>
<script type="text/javascript">
if (1==1 && 2==2) {
document.write('YES');
}
</script>
</head>
</html><html>
<head>
<script type="text/javascript">
if (1==1 && 2==2) {
document.write('YES');
}
</script>
</head>
</html>