Insert javascript in a page

General questions about CMSimple
Post Reply
doczimut
Posts: 75
Joined: Thu Dec 25, 2008 1:10 pm

Insert javascript in a page

Post by doczimut » Thu Nov 12, 2020 12:02 pm

Hello
I want to insert a script (Tripadvisor) in a page, only this one is not taken into account by the editor. I looked at the forum, but I didn't really find a solution, except #extended_valid_elements: 'script [language | type | src]' # in one of the files of Tinymce4 (Cmsimple_XH 1.74), but which one ?

Code: Select all

<script src="https://www.jscache.com/wejs?wtype=selfserveprop&amp;uniq=880&amp;locationId=5966297&amp;lang=fr&amp;rating=true&amp;nreviews=5&amp;writereviewlink=true&amp;popIdx=false&amp;iswide=false&amp;border=false&amp;display_version=2"></script>

doczimut
Posts: 75
Joined: Thu Dec 25, 2008 1:10 pm

Re: Insert javascript in a page

Post by doczimut » Thu Nov 12, 2020 2:51 pm

By reading the documentation of Tinymce4, I saw for the insertion of the javascript code it is necessary
To allow script elements in the editor, include the following in the TinyMCE configuration: extended_valid_elements : 'script[src|async|defer|type|charset]'
In the configuration of Tinymce4, the file [plugins/tinymce4/inits/init_fontawesome.js] is loaded, so I added the code:

Code: Select all

extended_valid_elements : 'script[src|async|defer|type|charset],span[*]'
My javascript is now taken into account. I hope I have done well!

---

This also works:

Code: Select all

extended_valid_elements: 'script[src],span[*]'

lck
Posts: 2366
Joined: Wed Mar 23, 2011 11:43 am
Contact:

Re: Insert javascript in a page

Post by lck » Thu Nov 12, 2020 5:52 pm

doczimut wrote:
Thu Nov 12, 2020 2:51 pm
This also works:

Code: Select all

extended_valid_elements: 'script[src],span[*]'
You can also use script[*] instead of script[src]. This should cover everything. See also here.
„Bevor du den Pfeil der Wahrheit abschießt, tauche die Spitze in Honig!“   👉 Ludwig's XH-Templates for MultiPage & OnePage

Post Reply