Jump to content

TinyMCE Editor - Allow Script Tags


mrigsby

Recommended Posts

I want to be able to add script tags and object/embed tags in my Knowledgebase articles and it currently comments them out. Can anyone point me in the right direction on how to change it to allow the script, embed and object tags?

 

Thanks in advance.

Link to comment
Share on other sites

  • 1 year later...
  • 6 months later...

You can allow script, iframe, or any other excluded tags by modifying the TinyMCE parameters.

 

You'll need to edit the editor.php file:

/admin/editor/editor.php

 

Find (probably Line 3):

tinyMCE.init({
mode : "textareas",
theme : "advanced",

 

And change to:

tinyMCE.init({
extended_valid_elements : "a[class|name|href|target|title|onclick|rel],script[type|src],iframe[src|style|width|height|scrolling|marginwidth|marginheight|frameborder],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name]",
mode : "textareas",
theme : "advanced",

 

Note: I've included tags for iframe, script, img, and a so that you can see how to use the parameter.

 

This will keep the editor from stripping out your tags. This is not a good option for areas of any website where the general public uses the editor.

Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated