Results 1 to 5 of 5

Thread: Use javascript in article

  1. #1
    New user
    Join Date
    03-08-10.
    Posts
    22

    Default Use javascript in article

    Hi there.

    I would like to use some very simple javascript code in an article, but can't figure out how to do this.

    This is what I would like to use:

    <script type="text/javascript" src="http://viewer.zmags.com/js/thumb.js"></script>
    <script type="text/javascript">
    var thumb = new Thumb(160693, "myThumb");
    thumb.setSize(141, 200);
    thumb.draw();
    </script>

    When I insert the code in a HTML-element it "cuts" the <script> tags. Is this because scripts are not allowed or am I just trying to insert the script in a wrong way?

    Thanks

    Best Regards
    Andreas

  2. #2
    User
    Join Date
    06-20-09.
    Posts
    115

    Default Re: Use javascript in article

    you usually have to change default settings to include <script> else it gets stripped.
    go to Settings > Security Settings > Allowed HTML tags and place it there
    geung

  3. #3
    New user
    Join Date
    03-08-10.
    Posts
    22

    Default Re: Use javascript in article

    Thank you so much.

    Thought I had allowed the <script> tag, but that was on a previous version of Typolight and I had forgot to do it on the new version.

  4. #4
    New user
    Join Date
    12-15-11.
    Posts
    1

    Default Re: Use javascript in article

    Hello,
    I tired what you said. I have the <div> tag added in the list of scripts to allow ij Contao security settings (version 2.9.3).
    I tried to add <script> but it won't remain there after saving. It's just not in the list.
    Whatever <div> or <script> tags I add to my articles in the HTML view, it gets stripped immediately...
    Any more help on this topic?
    Thanks,
    Dan

  5. #5
    User PaoloB's Avatar
    Join Date
    06-19-09.
    Location
    Italy
    Posts
    238

    Default Re: Use javascript in article

    To insert a javascript file, you can use the inserttag

    Put In the templates folder your file eg. myscript.php
    In Contao you can write {{file::myscript.php}} to include this file
    Paolo B.
    Contao ambassador
    ContaoCms.it - Sito di riferimento per la comunità italiana

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •