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
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
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.
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
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