locked
How to include a HTML script tag in a RichHTMLField (Publishing Site) RRS feed

  • Question

  • Hi,

    We tried to include a javascript file in a RichHTMLField control using the HTML Editor (e.g. <script type="text/javascript" src="somefile.js"></script>).  Whenever we close the window, the <script> tag is stripped from the HTML (I assume this behaviour is by default...).

    Is there a way / workaround to include a <script> tag in the content?

    Note: We cannot put the script inclusion in the page layout, because the "src" attribute is not fixed.  Also, the JS file creates HTML on-the-fly.  Our client wants to decided where the dynamic HTML will be written within its contents.

    Thanks

    - Mike
    Tuesday, November 4, 2008 10:27 PM

Answers

  • It is restricted to stop potential security breaches through JS script injection. The realistic alternative is to re-consider how you are using the Javascript, why the src is dynamic, how to provide an alternative way for the client to insert an area where the JS could write it's content out to etc

    Stu
    Wednesday, November 5, 2008 1:10 AM