DNN Forums

Ask questions about your website to get help learning DNN and help resolve issues.

DNN HTML Editor Constantly Stripping or Changing My Code

 27 Replies
 6 Subscribed to this topic
 40 Subscribed to this forum
Sort:
Page 1 of 3123 > >>
Author
Messages
Growing Member
Posts: 80
Growing Member
New Poster
New Poster
Congrats on posting!

Hey everyone,

I’m running into a frustrating issue with the DNN HTML editor. Every time I add custom HTML, CSS, or JavaScript to a module using the HTML editor, it keeps stripping out parts of my code or modifying it automatically when I go back in to edit.

For example:
Inline styles and script tags get removed or rewritten.
The editor sometimes reorders or reformats the markup.
When I save and reopen, certain tags or attributes vanish completely.
This makes it a pain to work with, especially when building custom layouts or embedding dynamic content.
I’ve already tried:
Switching between “Basic,” “Enhanced,” and “Advanced” modes in the HTML editor.
Checking the HTML editor provider settings (CKEditor).
Turning off “Replace Tokens” and enabling “Raw” mode when possible.
Still, the problem persists.
Has anyone found a reliable fix or workaround for this? Ideally, I’d like to disable all automatic filtering or sanitation so my code stays exactly as I entered it.
Thanks in advance — any insight would be greatly appreciated!

— Joseph
DNN Platformv. 10.01.02 (0)
.Net Framework4.8.0
Server NameNebulaWeb

Growing Member
Posts: 80
Growing Member
New Poster
New Poster
Congrats on posting!

ChatGPT suggested;
Editor Config field (top section, where you see “AllowedContent”), paste this:
AllowedContent: true,
ExtraAllowedContent: '*(*);*{*}',
AutoParagraph: false,
HtmlEncodeOutput: false,
Entities: false,
FillEmptyBlocks: false,
BeautifyOnSave: false,
StartupMode: 'source'

Advanced Member
Posts: 207
Advanced Member
Helpful Replier
Helpful Replier
Thanks for being such a helpful replier!
MVP
MVP
You're an MVP!
New Poster
New Poster
Congrats on posting!

This may be becuase of the security feature in DNN.  Here is my ChatGTP answer.

Question: In DNN CMS the security fo rthe ediotr strips JS from the input, how can i stop that in DNN10

Answer:

Ha Ha.... I can post it here becuse of security, :-)   Ask the question to chatgpt.

Advanced Member
Posts: 207
Advanced Member
Helpful Replier
Helpful Replier
Thanks for being such a helpful replier!
MVP
MVP
You're an MVP!
New Poster
New Poster
Congrats on posting!
can NOT post that is.
Advanced Member
Posts: 178
Advanced Member
2 Helpful Replier
Helpful Replier
Thanks for being such a helpful replier!
New Poster
New Poster
Congrats on posting!
4 Engaged Reader
Engaged Reader
You are an engaged reader!
Avid Reader
Avid Reader
Avid Reader art thou!
David, pls explain?
Senior Member
Posts: 1322
Senior Member
3 Helpful Replier
Helpful Replier
Thanks for being such a helpful replier!
Lifesaver
Lifesaver
You're Life Saver!
New Poster
New Poster
Congrats on posting!
3 Engaged Reader
Engaged Reader
You are an engaged reader!
Advanced Member
Posts: 132
Advanced Member
Helpful Replier
Helpful Replier
Thanks for being such a helpful replier!
MVP
MVP
You're an MVP!
2 Engaged Reader
Engaged Reader
You are an engaged reader!
Avid Reader
Avid Reader
Avid Reader art thou!
As others have noted most likely this is due to the default configurations of CKEditor.

I do encourage you to consider however the risks associated with opening this up, especially if you have multiple levels of users that make content edits as you can expose yourself to risks, especially with JS inclusions.
Growing Member
Posts: 68
Growing Member

Mitchel,

If adding CSS to a content section to format text is regarded as a security risk then what is the suggested alternative.

I use classes to format complex tables so they can be viewed on phones. 

Regards

Veteran Member
Posts: 838
Veteran Member
3 Helpful Replier
Helpful Replier
Thanks for being such a helpful replier!
New Poster
New Poster
Congrats on posting!

Hi Simon,
Tables are usually styled in the CSS of the theme. Or in the module.
Styling in the editor makes it part of the content and therefore inefficient.

If for some reason you can not edit the code of the theme or module, you can always use the portal.css to overwrite other css.

The HTML editor can be set quite specific. For instance to allow classes but not divs or js.

Growing Member
Posts: 68
Growing Member

I have been trying to open the CKEditor Provider Settings space on a number of my DNN 10.2.0 sites. The Loading Options popup never goes away and I am unable to make the changes I need to make. Aware that site size may have an impact I have tried this on my smallest site (3 pages) and again unable to open this.

Have there been changes intended to stop any editing of these parameters?

Page 1 of 3123 > >>

These Forums are for the discussion of the open source CMS DNN platform and ecosystem.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. If you have (suspected) security issues, please DO NOT post them in the forums but instead follow the official DNN security policy
  2. No Advertising. This includes the promotion of commercial and non-commercial products or services which are not directly related to DNN.
  3. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  4. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  5. No Flaming or Trolling.
  6. No Profanity, Racism, or Prejudice.
  7. Site Moderators have the final word on approving / removing a thread or post or comment.
  8. English language posting only, please.

Would you like to help us?

Awesome! Simply post in the forums using the link below and we'll get you started.

Get Involved