+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / Enabling scripts

Enabling scripts

6 posts, 1 answered
  1. Nimit
    Nimit avatar
    90 posts
    Registered:
    27 Mar 2009
    21 Oct 2009
    Link to this post
    Hi,
    I am doing an upgrade of a project to 3.7 and I want to enable the javascript in rad editor so that I can use in Generic Content control in Sitefinity 3.7. how can I do it. Please reply ASAP.

    regards,
    Nimit verma.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    21 Oct 2009
    Link to this post
    Hello Nimit,

    By default GenericContent control supports javascript tags. Currently this behavior is controlled by RadEditor's ContentFilters property declared in the control template. The default filters are: EncodeScripts,FixUlBoldItalic,FixEnclosingP,IECleanAnchors,MozEmStrong,ConvertFontToSpan,ConvertToXhtml,IndentHTMLContent

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Nimit
    Nimit avatar
    90 posts
    Registered:
    27 Mar 2009
    21 Oct 2009
    Link to this post
    Hi Ivan,
    Thanks for the reply.
    I will give you an example to explain my issue. In the Generic content if I enter the content in the html view as
    <script type='text/javascript">alert('test');</script>
    After I publish it and edit the page to check if it is fine, it changes the code to :
    <script type="text/javascript&quot;&gt;alert("></body></html></script>.

    So how can I make the radeditor not to change the script which I am putting in it, I mean how can I enable the script in RadEditor.
    Please reply ASAP.

    Regards,
    Nimit Verma.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    21 Oct 2009
    Link to this post
    Hello Nimit,

    Please give a try to the following code:

    <script language="javascript">
    alert('test');
    </script>

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Answered
  5. Nimit
    Nimit avatar
    90 posts
    Registered:
    27 Mar 2009
    21 Oct 2009
    Link to this post
    Hi Ivan,
    Thanks for the reply.
    The code you sent me it worked.
    No the next thing which I thought would work as well but didn't.
    Can I use Javascript like this.

     

    <script language="javascript" src="Custom/ManagedLayerApi.js"></script>

     

    and then use the javascript function in the Generic Content HTML view.
    please Reply ASAP.


    Regards,
    Nimit Verma.
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    26 Oct 2009
    Link to this post
    Hello Nimit,

    You need to add script src tag in your master page. Then you can directly use <script> ..your code here </script> in the RadEditor. Another option is adding the html page declaration in the RadEditor

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <head runat="server">
        <title></title>
        <script src="http://code.jquery.com/jquery-latest.js"></script>
    </head>
    <body>
        <div>
            <span id="test" runat="server"></span>
            <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server" />
             
        </div>
    </body>
    </html>


    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Register for webinar
6 posts, 1 answered