You need to be logged in to post in the forum - Log In

An active JCE Pro Subscription is required to post in the forum - Buy a Subscription

Support is currently Offline

Official support hours
Monday to Friday
09:00 - 17:00 Europe/London (BST)

Please create a new Ticket and we will get back to you as soon as we can.

#102999 JavaScript get removed before saving

Posted in ‘Editor’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Latest post by dcl698 on Thursday, 30 July 2020 19:58 BST

MT
Hi Ryan,

I tried to follow the instruction to prevent JCE removed JavaScript code, but my JavaScript code is still gets removed before saving.

I set the Text Filters to No Filtering and allow JavaScript, CSS, and PHP to Super User.

I insert a piece of JavaScript code in the Code Tab, switch to Editor Tab, then switch to Code Tab and that piece of code is gone.

I have it in my local computer with Joomla 3.9.13. I only have one extension installed which is JCE 2.7.19.

Please advise.

Thank you,

M


Ryan
Please post an example of the code, or a screenshot of the code. that you are trying to add.

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

MT
Hi Ryan,

I could not post the code. I got blocked. What is the best way for me to give you the JavaScript code?

Thanks,
M

Ryan
Please post a screenshot of the code, or attached a zip file containing the code in a text file.

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

MT
The JavaScript code is for a pop up text.





Attachments

Ryan
Please send me a login - https://www.joomlacontenteditor.net/contact/site-login

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

MT
Hi Ryan,

Since the error happens on my local computer, I cannot send you a login.

However, I have a test environment that I could send you a login. On my test environment, I never add JavaScript code using JCE because I normally use Sourcerer. I just learned that I can do it in JCE, so I test it on my local computer first and it gave me the removing code before saving. It turned out that when I tried on my test environment, I was able to insert that code to both K2 item and Joomla article.

My local computer and my test environment has the same versions of Joomla and JCE. The different settings are the test site has PHP 7.2.20 and MySQL 5.6.44 while my local computer has PHP 7.3.8 and MySQL 5.7.26. Do you think the setting has something to do with the removing code?

I think I will pause this question until I work on another real test environment and have this issue in the future. I will contact you again.

Thank you,

M

Ryan
My local computer and my test environment has the same versions of Joomla and JCE. The different settings are the test site has PHP 7.2.20 and MySQL 5.6.44 while my local computer has PHP 7.3.8 and MySQL 5.7.26. Do you think the setting has something to do with the removing code?


No, but double check your configuration options. Please see - https://www.joomlacontenteditor.net/support/faq/editor/scripts-removed-on-saving

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

MT
Ryan,

I found the mystery. I just noticed on the Editor Profile, the user group that I am in is under Default. When I reorder by moving my group to stay above the Default, I was able to insert the JavaScript code on my local computer.

Thank you for your time as always.

M

1LM
No, but double check your configuration options. Please see - https://www.joomlacontenteditor.net/support/faq/editor/scripts-removed-on-saving


To piggy back on this issue. I have triple checked the settings as outlined in the linked article and the javascript code the I'm attempting to load is still getting removed on save. Is there any other setting that could cause this to happen? Side note: also having same issue with SVG files after following all the guidance that i could find.

Joomla! 3.9.20
JCE 2.8.14
Database Type mysql
PHP Version 7.2.32

Ryan
I have triple checked the settings as outlined in the linked article and the javascript code the I'm attempting to load is still getting removed on save.


Please post a screenshot of the code.

Side note: also having same issue with SVG files after following all the guidance that i could find.


For svg, please try this plugin - https://github.com/widgetfactory/jce-editor-svg

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

1LM
Screenshots of settings attached

Attachments

Ryan
@1LM - Do you have RSFirewall installed?

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

1LM
@1LM - Do you have RSFirewall installed?


No, we don't have a firewall in place.

However I was just tinkering around I was able to get the code to save. I only did two things since my initial post in this thread and I am not sure which fixed the issue.
1. I moved the "Super" profile to first, although when I tested the embed right afterward, it still got stripped. So not sure if cache is in play here.
2. In "Plugin Parameters" > "Source Code Tab" there is a setting for "Theme" this was initially set to "CodeMirror". I changed it to "Cobalt" and voila!s The code did NOT get stripped. I am not sure if "CodeMirror" is the default theme and if its piggybacking off the CodeMirror editor which I'd bet disallows javascript? In any case its working now.

Attachments

Ryan
The Source Code theme should have no effect on the content in the Code editor. It was most likely related to the profile ordering, especially if you were also assigned to the other profile that was initially above the "Super" profile, and it did not allow javscript.

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

dcl698


I am also having this issue. Followed the steps on the "Scripts removed on saving" page, and moved the active profile to the top of the list. I am a super user and have "No Filtering" set in Global config. See the attached for the change that happens to my script when I toggle to the Editor then back to the Code view

Attachments

Ryan
@dcl698 - Please try JCE Pro 2.8.16 Beta - https://www.joomlacontenteditor.net/downloads/editor/pro/development/jce-pro-2-8-16-dev

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

dcl698
That fixes the issue!