# \[innerHTML\] rip off script tag?

**URL:** <https://forum.ionicframework.com/t/innerhtml-rip-off-script-tag/64623>\
**Category:** ionic-v3\
**Created:** [September 27, 2016, 4:39am UTC](https://forum.ionicframework.com/t/innerhtml-rip-off-script-tag/64623 "2016-09-27T04:39:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![MacG](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@MacG](https://forum.ionicframework.com/u/MacG)\
**Post date:** [September 27, 2016, 4:39am UTC](https://forum.ionicframework.com/t/innerhtml-rip-off-script-tag/64623/1 "2016-09-27T04:39:03Z")

</div>

Hello sir, I’m right now build a mobile app using a JSON API from my blog at wordpress…

I usually upload a photo to Instagram and embed it to my blog…

Now I cannot see my photo from embed tag from Instagram…

I’m using a [innerHTML] to make my data from JSON API look like a html…  
But I realize, js who responsible to load my photo from Instagram is missing…

Is the [innerHTML] rip them of from my json ??

Here’s for comparison

This is the JSON data that contain `<script>`

 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/3/2/327d08b6df247df9ff99a742d97f2927f2132979.png)

Here is the element that shown on the app after the content passed the [innerHTML]

 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/b/9/b9b8b59decf847be60c374ee7a5b075d43a4eb28.png)

Is this problem solveable ? or I need change the [innerHTML] to another function ??

Any response apriciated 😉

---

<div class="post-metadata">

**Author:** ![Thavarajan](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/thavarajan/32/103608_2.png) [@Thavarajan](https://forum.ionicframework.com/u/Thavarajan)\
**Post date:** [September 27, 2016, 4:44am UTC](https://forum.ionicframework.com/t/innerhtml-rip-off-script-tag/64623/2 "2016-09-27T04:44:56Z")

</div>

By native this is an angular 2 security feature,

please go through this  
[Preventing cross-site scripting (XSS)](https://angular.io/docs/ts/latest/guide/security.html#!#xss)

it’s better find an alternate way

---

<div class="post-metadata">

**Author:** ![MacG](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@MacG](https://forum.ionicframework.com/u/MacG)\
**Post date:** [September 27, 2016, 7:37am UTC](https://forum.ionicframework.com/t/innerhtml-rip-off-script-tag/64623/3 "2016-09-27T07:37:11Z")

</div>

Can you give me an example of the alternative way ?

---

<div class="post-metadata">

**Author:** ![infoproducts](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/infoproducts/32/100372_2.png) [@infoproducts](https://forum.ionicframework.com/u/infoproducts)\
**Post date:** [September 27, 2016, 11:56am UTC](https://forum.ionicframework.com/t/innerhtml-rip-off-script-tag/64623/4 "2016-09-27T11:56:48Z")

</div>

You need to bypass html sanitization.  
Take a look at: [Inserting HTML via Angular 2: Use of DomSanitizationService & bypassSecurityTrustHtml](https://forum.ionicframework.com/t/inserting-html-via-angular-2-use-of-domsanitizationservice-bypasssecuritytrusthtml/62562)

---

<div class="post-metadata">

**Author:** ![MacG](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@MacG](https://forum.ionicframework.com/u/MacG)\
**Post date:** [September 29, 2016, 5:02am UTC](https://forum.ionicframework.com/t/innerhtml-rip-off-script-tag/64623/5 "2016-09-29T05:02:58Z")

</div>

so I need to make a service right ? and copy your code to make the angular let Instagram `script` going through ??

---

<div class="post-metadata">

**Author:** ![MacG](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@MacG](https://forum.ionicframework.com/u/MacG)\
**Post date:** [October 2, 2016, 10:08am UTC](https://forum.ionicframework.com/t/innerhtml-rip-off-script-tag/64623/6 "2016-10-02T10:08:44Z")

</div>

I already make the pipes file…

But I now can show the style, but it’s still not load the photo (I think the `<script>` still get sanitize)…

It look like this…

 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/3/f/3f9a2b960e58264374123ae9f5ab4603898b21d3.jpg)

\*note : I’m just using the `html` safe-pipe like this  
`<div [innerHTML]="post?.post?.content | safe: 'html'"></div>`

Any reply apriciated 😉

\*EDIT… It happen because the embed code is look like this…

```auto
<blockquote class="instagram-media" style="background: #FFF; border: 0; border-radius: 3px; box-shadow: 0 0 1px 0 rgba(0,0,0,0.5),0 1px 10px 0 rgba(0,0,0,0.15); margin: 1px; max-width: 658px; padding: 0; width: calc(100% - 2px);" data-instgrm-captioned="" data-instgrm-version="7">
<div style="padding: 8px;">
<div style="background: #F8F8F8; line-height: 0; margin-top: 40px; padding: 28.1944444444% 0; text-align: center; width: 100%;"></div>
<p style="margin: 8px 0 0 0; padding: 0 4px;"><a style="color: #000; font-family: Arial,sans-serif; font-size: 14px; font-style: normal; font-weight: normal; line-height: 17px; text-decoration: none; word-wrap: break-word;" href="https://www.instagram.com/p/BLANyeyDZiJ/" target="_blank">Let the adventure begin ! #travel</a></p>
<p style="color: #c9c8cd; font-family: Arial,sans-serif; font-size: 14px; line-height: 17px; margin-bottom: 0; margin-top: 8px; overflow: hidden; padding: 8px 0 7px; text-align: center; text-overflow: ellipsis; white-space: nowrap;">A video posted by M Argus Chopin Gyver (@macgwik) on <time style="font-family: Arial,sans-serif; font-size: 14px; line-height: 17px;" datetime="2016-10-01T02:22:04+00:00">Sep 30, 2016 at 7:22pm PDT</time></p>

</div></blockquote>
<script async defer src="//platform.instagram.com/en_US/embeds.js"></script>

```

And I thought, the one that get trusted, only the `<blockqoute>`. and the `<script>` still get sanitized
