# Render HTML Ionic 2

**URL:** <https://forum.ionicframework.com/t/render-html-ionic-2/60098>\
**Category:** ionic-v3\
**Created:** [August 10, 2016, 7:24am UTC](https://forum.ionicframework.com/t/render-html-ionic-2/60098 "2016-08-10T07:24:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anhquan1210](https://avatars.discourse-cdn.com/v4/letter/a/7ab992/32.png) [@anhquan1210](https://forum.ionicframework.com/u/anhquan1210)\
**Post date:** [August 10, 2016, 7:24am UTC](https://forum.ionicframework.com/t/render-html-ionic-2/60098/1 "2016-08-10T07:24:21Z")

</div>

I use [innerHTML] = {{content}} to render HTML. But this way stripped some tag of my content. Ex : iframe tags.  
How can i do another way?  
Somebody help me, pls. Thanks so much.

---

<div class="post-metadata">

**Author:** ![hackfrag](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/hackfrag/32/100701_2.png) [@hackfrag](https://forum.ionicframework.com/u/hackfrag)\
**Post date:** [August 10, 2016, 7:40am UTC](https://forum.ionicframework.com/t/render-html-ionic-2/60098/2 "2016-08-10T07:40:16Z")

</div>

Hi,

i wrote a component for displaying wordpress content which removes script tags and also detect internal links

> <https://gist.github.com/hackfrag/e6e4d2d593db1a61bcb75d8c8d022e0e>

How to use:  
`<wordpress-content [content]="page?.content?.rendered" (link)="onInteralLink($event)"></wordpress-content>`

Hope this helps.

---

<div class="post-metadata">

**Author:** ![anhquan1210](https://avatars.discourse-cdn.com/v4/letter/a/7ab992/32.png) [@anhquan1210](https://forum.ionicframework.com/u/anhquan1210)\
**Post date:** [August 10, 2016, 1:09pm UTC](https://forum.ionicframework.com/t/render-html-ionic-2/60098/3 "2016-08-10T13:09:02Z")

</div>

thank you! I resolved this problem. I use this.sanitizer.bypassSecurityTrustHtml(data.content\_text);

---

<div class="post-metadata">

**Author:** ![eheading](https://avatars.discourse-cdn.com/v4/letter/e/0ea827/32.png) [@eheading](https://forum.ionicframework.com/u/eheading)\
**Post date:** [August 12, 2016, 3:33pm UTC](https://forum.ionicframework.com/t/render-html-ionic-2/60098/4 "2016-08-12T15:33:25Z")

</div>

> [@anhquan1210](#):
>
> this.sanitizer.bypassSecurityTrustHtml(data.content\_text);

I faced the same problem as you, iframe tag can’t be showed by using [innerHTML]. Could you please kindly explain how to use this.sanitizer.bypassSecurityTrustHtml(data.content\_text); ? Many thanks !

---

<div class="post-metadata">

**Author:** ![Solsticesurfer](https://avatars.discourse-cdn.com/v4/letter/s/b5a626/32.png) [@Solsticesurfer](https://forum.ionicframework.com/u/Solsticesurfer)\
**Post date:** [September 27, 2016, 11:29pm UTC](https://forum.ionicframework.com/t/render-html-ionic-2/60098/5 "2016-09-27T23:29:49Z")

</div>

For others that may be looking for an answer, here is my attempt. Keep in mind that if the target site has set their X-Frame-Options to SAMEORIGIN, you will not be able to embed it.

```
// In your .ts backing file, at the declaration-level
import { DomSanitizationService } from '@angular/platform-browser';

// in your constructor, include the declaration and assignment
constructor(private sanitizer: DomSanitizationService, ......) {....}

```

Now, in your page’s html, add the binding like so where FIELD is the object that you want to embed:  
`<p [innerHTML]="sanitizer.bypassSecurityTrustHtml(FIELD)"></p>`

That’s it. Hope this helps.
