snippet for Javascript

4 posts, 0 answers
  1. Aslam
    Aslam avatar
    9 posts
    Member since:
    Dec 2010

    Posted 30 Nov 2011 Link to this post

    Hi there,

    I have read "code snippets" as chunk of HTML.

    My project needs me to add snippet that has chunk of JavaScript, such as twitter search widget.
    Does not need to show on Editor Design though(as <script> etc).
    How can we achieve this?

    regards
    ami
  2. Rumen
    Admin
    Rumen avatar
    14431 posts

    Posted 02 Dec 2011 Link to this post

    Hello Ami,

    RadEditor automatically strips the <script> tags and to allow them you should disable the RemoveScripts filter.

    Best regards,
    Rumen
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  3. Aslam
    Aslam avatar
    9 posts
    Member since:
    Dec 2010

    Posted 02 Dec 2011 Link to this post

    Thanks for  reply.
    But my issue is adding a snippet that contains javascript
    something below as snippet

    <script src="http://widgets.twimg.com/j/2/widget.js"></script>
    <script>
    new TWTR.Widget({
      version: 2,
      type: 'search',
      search: 'rainbow',
      interval: 30000,
      title: 'It\'s a double rainbow',
      subject: 'Across the sky',
      width: 250,
      height: 300,
      theme: {
        shell: {
          background: '#8ec1da',
          color: '#ffffff'
        },
        tweets: {
          background: '#ffffff',
          color: '#444444',
          links: '#1985b5'
        }
      },
      features: {
        scrollbar: false,
        loop: true,
        live: true,
        behavior: 'default'
      }
    }).render().start();
    </script>

    ----------------------------------------

    Does snippet allow Javascript?
  4. Rumen
    Admin
    Rumen avatar
    14431 posts

    Posted 02 Dec 2011 Link to this post

    Hello Aslam,

    Put some content for example a &nbsp; before the <script> tag, because in other case IE will strip it, e.g.

    &nbsp;
    <script>...

    Kind regards,
    Rumen
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Back to Top