SCEditor Remove iFrame Tag

If you are using SCEditor as a rich text editor in your Angular/React application and you are trying are seeing that the iFrame tag is removed from the editor then I have a solution for your problem.


The SCEditor is removing the iFrame tags to avoid the XSS attacks. How to allow the iFrame tags in SCEditor?


So basically you need to tell the SCEditor that we have a list of allowed URLs that need to be whitelisted for iFrames. This can be done by providing an array of strings to the SCEditor instance as shown in the following code:

sceditor.create(this.scEditor.nativeElement, {
      format: 'xhtml',
      style: '',
      toolbar: "bold,italic,underline|left,center,right,justify|font,size,color,removeformat|bulletlist,orderedlist|ltr,rtl|image,table,link,unlink,youtube,code|maximize,source",
      allowedIframeUrls: ['']

I hope this solution will help you fix your problem. If you have any questions, please ask in the comments section. Thanks


Leave a Comment

Your email address will not be published. Required fields are marked *