javascript Joomla 3 无法将 <script> 添加到文章

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26839930/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 06:35:05  来源:igfitidea点击:

Joomla 3 can't add <script> to article

javascriptwysiwygjoomla3.0tinymce-4

提问by vladimir

Joomla version:Joomla! 3.3.6 Stable [ Ember ] 01-October-2014 02:00 GMT

Joomla 版本:Joomla!3.3.6 稳定 [Ember] 01-October-2014 02:00 GMT

I want add js script to one my article. I'm using TinyMCE editor to edit article.

我想在我的一篇文章中添加 js 脚本。我正在使用 TinyMCE 编辑器来编辑文章。

In TinyMCE plugin field Prohibited ElementsI filled with dummy text, now it contains "cms123", I removed "script,applet,iframe".

在 TinyMCE 插件字段Prohibited Elements 中,我填充了虚拟文本,现在它包含“cms123”,我删除了“script、applet、iframe”。

I checked Global Configurations-> Text Filtersfor Super UsersI have set it "No Filtering".

我检查全局配置- >文本过滤器超级用户我已经设置为“无过滤”。

But when I'm trying to save my article with js code, joomla removes my tags <script>from my article, also I checked with <iframe>, joomla replaced this tag with <i-frame>tag... I'm really confused, I can't understand what is wrong.

但是当我试图用 js 代码保存我的文章时,joomla<script>从我的文章中删除了我的标签,我也检查了<iframe>,joomla 用标签替换了这个<i-frame>标签......我真的很困惑,我不明白出了什么问题.

Can anybody help me?

有谁能够帮我?

Thanks.

谢谢。

回答by Shan Mugam

Actually, i spent 4 hrs to find out this issue and got solution now. just login to administrator then go to System-->Global configuration, under that you will see "Site Settings", in that you will find-out "Default Editor", select as "Editor - CodeMirror" and save it. after that go to articles, then add your script. Enjoy :)

实际上,我花了 4 个小时来找出这个问题,现在得到了解决方案。只需登录管理员然后进入系统-->全局配置,在那里你会看到“站点设置”,在那里你会找到“默认编辑器”,选择“编辑器 - CodeMirror”并保存它。之后转到文章,然后添加您的脚本。享受 :)

回答by Daniel Murphy

I just came across this problem today and I confirm the same problem. I could not remove the "script" prohibited elements but I was able to remove everything else. I then tried just putting a period in the Prohibited Elements input box, saved and I now can use script tags. I frames work too. I'm using 3.3.6. Strange.

我今天刚遇到这个问题,我确认了同样的问题。我无法删除“脚本”禁止元素,但我能够删除其他所有内容。然后我尝试在“禁止元素”输入框中输入一个句点并保存,现在我可以使用脚本标签了。我的框架也工作。我正在使用 3.3.6。奇怪的。

  1. Global Configurations -> Text Filters for Super Users - set it "No Filtering"
  2. Users -> User Manager - Make sure you have Super User privileges
  3. Extensions -> Plugin Manager -> Filter:Editors -> TnyMCE -In the TinyMCE plugin field, add a period in the "Prohibited Elements" field
  1. 全局配置 -> 超级用户的文本过滤器 - 将其设置为“无过滤”
  2. 用户 -> 用户管理器 - 确保您拥有超级用户权限
  3. Extensions -> Plugin Manager -> Filter:Editors -> TnyMCE - 在 TinyMCE 插件字段中,在“Prohibited Elements”字段中添加句点

回答by David

I've spent quite a while getting to bottom of this - even after installing JCE editor the problem persisted. It turned out that another security component RSFirewall was running inthe background stripping out prohibited elements.

我花了很长时间才弄明白这个问题 - 即使在安装了 JCE 编辑器之后,问题仍然存在。原来,另一个安全组件 RSFirewall 正在后台运行,以去除被禁止的元素。

The solution therefore is to add an exception in the RSFirewall firewall configuration: https://www.rsjoomla.com/support/documentation/view-article/785-scrambled-tags-iframe-becomes-i-frame.html

因此,解决方案是在 RSFirewall 防火墙配置中添加一个例外:https://www.rsjoomla.com/support/documentation/view-article/785-scrambled-tags-iframe-becomes-i-frame.html

回答by tala9999

Got the same issue. I'm using 3.6.2. Here are how I get it works:

得到了同样的问题。我正在使用 3.6.2。以下是我如何让它工作:

  1. Global Configurations -> Text Filters for Super Users - set it "No Filtering"
  2. Users -> User Manager - Make sure you have Super User privileges
  3. Extensions -> Plugin Manager -> Filter:Editors -> TnyMCE -In the TinyMCE plugin field, remove "script" in the "Prohibited Elements" field
  4. In "Extended Valid Elements", add "script"
  1. 全局配置 -> 超级用户的文本过滤器 - 将其设置为“无过滤”
  2. 用户 -> 用户管理器 - 确保您拥有超级用户权限
  3. 扩展 -> 插件管理器 -> 过滤器:编辑器 -> TnyMCE - 在 TinyMCE 插件字段中,删除“禁止元素”字段中的“脚本”
  4. 在“扩展有效元素”中,添加“脚本”

And I'm able to add script tags in the article now.

我现在可以在文章中添加脚本标签了。

enter image description here

在此处输入图片说明

回答by Gopal Patel

i think you have to use jce editor

我认为你必须使用 jce 编辑器

https://www.joomlacontenteditor.net/

https://www.joomlacontenteditor.net/

which is allow you to add all tag .

这允许您添加所有标签。

May be Help

可能有帮助

Thanks

谢谢