WARNING: sanitizing HTML stripped some content

I have SVG in an sql table. For example :
<span style="font-size: 100%; display: inline-block;" class="MathJax_SVG" id="MathJax-Element-5-Frame"><svg xmlns:xlink="http://www.w3.org/1999/xlink" width="2.18ex" height="2.343ex" style="vertical-align: -0.171ex;" viewBox="0 -934.9 938.6 1008.6" role="img" focusable="false"><g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)"><g transform="translate(0,362)"><use transform="scale(0.707)" x="0" y="0" xlink:href="#STIXWEBMAIN-2212"></use><use transform="scale(0.707)" x="685" y="0" xlink:href="#STIXWEBMAIN-32"></use></g></g></svg></span>

When I want it to appear, there is just a blank, all has diseapeared except this :
<span class="MathJax_SVG"></span>

And the console shows me “WARNING: sanitizing HTML stripped some content”

The issue wasn’t here before I switched to RC.

See Dom-Sanitizer from angular2 and after you can bypasssecurity so, nothing will be stripped in your content.

1 Like

Thanks, it worked easily. To help in this situation :

  • in your page.ts,

    `import { DomSanitizer } from ‘@angular/platform-browser’;
    constructor(…, private sanitizer: DomSanitizer)

  • in the html file :
    <p [innerHTML]="sanitizer.bypassSecurityTrustHtml(yourtext)">

6 Likes

Only:
constructor(…, public sanitizer: DomSanitizer)

@trollanfer yes its working in ionic 3 thanks dear