<script> tag Stripped from Content
Added by Will Fastie over 1 year ago
I have the following script tag, which is used to encode email addresses on sites I build:
<script type="text/javascript">CMS.nb("choel", 'cc', "Cindy Hoel", "From CMS24-7.com: ");</script>
elRTE is stripping these tags when they are part of the content. The stripping happens when switching from Source View back to the Editor.
Is there a way to prevent this behavior?
Replies (8)
RE: <script> tag Stripped from Content
-
Added by Troex Nevelin over 1 year ago
There is a bug #302, but actually I can't find the exact situation when it happens, looks like it cuts only when you edit around <script> tag, but i'm not sure...
RE: <script> tag Stripped from Content
-
Added by Will Fastie over 1 year ago
I cut and pasted HTML source code that included a script tag in the Source view. When I switched to Editor view or simply saved the page, the script tag was removed.
RE: <script> tag Stripped from Content
-
Added by Dave Jansen about 1 year ago
I'm experiencing exactly the same over here, everything between the <script> </script> tags (includes the tags itself) get removed. I tried to remove the scriptregexp, replace this with a nonsens regexp, but still no difference..
RE: <script> tag Stripped from Content
-
Added by Troex Nevelin about 1 year ago
Can you please provide the code where it gets cut, because we cannot track down when exactly it happens. Because not always <script> tag is cut
RE: <script> tag Stripped from Content
-
Added by Will Fastie about 1 year ago
If all I do is place the code given in my original post above into the source view and then switch to the editor view, the tag will be replaced with a non-breaking space. But wherever the <script> tag is, regardless of the surrounding content, it gets stripped. This is 100% repeatable.
RE: <script> tag Stripped from Content
-
Added by Joel Urbina about 1 year ago
Would LOVE to have a work around for this... I'm having to write any javascript includes as echos inside of PHP includes which I finally sorted out how to make a work around for...
PHP can be included like so:
<!--
<?php
echo "-->";
include_once("lib/jquery/il-livesearch.php");
echo "<!--";
?>
-->
RE: <script> tag Stripped from Content
-
Added by Bernhard Pfeifer 12 months ago
Will Fastie wrote:
If all I do is place the code given in my original post above into the source view and then switch to the editor view, the tag will be replaced with a non-breaking space. But wherever the <script> tag is, regardless of the surrounding content, it gets stripped. This is 100% repeatable.
I actually ran into the same problem and after digging some three hours into the code I think I found the cause. The object 'wysiwyg' in elRTE.prototype.filter.prototype.chains seems to be in the wrong order.
Original:
wysiwyg : ['allowedTags', 'clean', 'replace', 'deniedTags', 'compactStyles'],
Working:
wysiwyg : ['replace', 'clean','allowedTags', 'deniedTags', 'compactStyles'],
Note that the replace function must be called before clean so that existing script tags get internally rewritten into comments. After that, call the clean function and everything will be fine.
Hope that helps.
Cheers,
Bernhard
RE: <script> tag Stripped from Content
-
Added by Troex Nevelin 12 months ago
thanks a lot we've been hunting this for very long time
(1-8/8)