Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Max 144 posts 166 karma points
    Apr 18, 2011 @ 09:14
    Max
    1

    How to allow Javascript in Umrbaco richtext editor

    I have pages that have different java script slider scritps i need to add it in different pages how do i allow javascripts in different pages in the rich text editor

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Apr 18, 2011 @ 09:40
    Jan Skovgaard
    1

    Hi Max

    You can do this by disabling tidy in the umbracoSettings.config - however I don't recommend you do this. Allowing people to insert javascript in the RTE is never a good idea, since it can break havoc on the site if people don't know what they're doing.

    Is it a requirement that you insert the script directly in the rich text area? It really should be used for content only...not functionality.

    Would'nt it be possible for you to solve it by creating a macro, which can take parameters and contain the neccesary scripting. Then you can insert that macro into your rich text editor and make it all work.

    Could this be the proper solution for you?

    /Jan

  • Max 144 posts 166 karma points
    Apr 18, 2011 @ 10:11
    Max
    0

    yes using macro is also agood idea but how to put javascript in xslt macros any links or solutions wil be useful

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Apr 18, 2011 @ 10:50
    Jan Skovgaard
    1

    Hi Max

    Is the script you're using something custom made or is it based on existing jQuery sliders for example?

    What specific script di you need to insert?

    usually scripts are inserted in xslt as character data like this example here: http://www.w3schools.com/xml/xml_cdata.asp

    Usually I do it this way in my XSLT files.

    <xsl:text disable-output-escaping="yes">
    <![CDATA[
    <script type="text/javascript">
    //js here...
    </script>
    ]]>
    </xsl:text>

    Does it make sense?

    /Jan

  • Max 144 posts 166 karma points
    Apr 18, 2011 @ 13:25
    Max
    0

    yes it was very useful indeed

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Apr 18, 2011 @ 13:26
    Jan Skovgaard
    0

    Hi Max

    I'm happy to hear that.

    If it solved your issue could you then please mark this post as solved? :-)

    Cheers.

    /Jan

  • Andrew Todd 5 posts 25 karma points
    Aug 28, 2014 @ 17:43
    Andrew Todd
    0

    Jan,

    Since this post was never marked as solved, I thought I would post my similar problem. We currently have many (100s) of videos stored in our cloud service and as of right now we can't embed them like you would a YouTube video. We have to use raw javascript with parameters to make the videos play on our sites. Because we have so many videos, I don't see how a macro would help as there would have to be a macro for EVERY single video. I wanted to make it easy for our marketing team to insert videos. This project is a very large one. We are converting our old lecture software to a web-based application and there are several "slides" with videos.

    I have tried creating a macro and it does work but I don't want them to have to create one for every video like a said above. I have also tried removing the valid elements from TinyMCE and turning off Tidy but that doesn't work. It moves the <script> tags outside of the CDATA tags so nothing is displayed on the site. If I manully move the script tags back in then all I see is the javascript code on the site.

    I am using the latest Umbraco. Any help would be greatly appreciated

Please Sign in or register to post replies

Write your reply to:

Draft