# Iframe dark magic... dont try this at work

**URL:** <https://forum.inductiveautomation.com/t/iframe-dark-magic-dont-try-this-at-work/57748>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [March 29, 2022, 10:48am UTC](https://forum.inductiveautomation.com/t/iframe-dark-magic-dont-try-this-at-work/57748 "2022-03-29T10:48:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [March 29, 2022, 10:48am UTC](https://forum.inductiveautomation.com/t/iframe-dark-magic-dont-try-this-at-work/57748/1 "2022-03-29T10:48:41Z")

</div>

**WARNING**  
Soo… this has the potential to **break the designer** (if you press preview), so be careful about the dark magic i am about to share…

But it has the great power to code html and even javascript in perspective!

BEHOLD:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/9/a98e093c27d16806a0519db4f15c688e981f3edf.png)

iframe src can render strings as html!  
`data:text/html,<button onclick=alert('MAGIC')>Magic</button>`

It works with `<script>` BUT this seems to freeze the designer if you press preview mode.

You **cant communicate with the components** outside the iframe (i think cuz its an iframe afterall, unless perspective has a window message handler that can be called in js) , but still might be some fun things to try with this 🧙‍♂️

---

<div class="post-metadata">

**Author:** ![tamerplc](https://avatars.discourse-cdn.com/v4/letter/t/d78d45/32.png) [@tamerplc](https://forum.inductiveautomation.com/u/tamerplc)\
**Post date:** [March 29, 2022, 12:19pm UTC](https://forum.inductiveautomation.com/t/iframe-dark-magic-dont-try-this-at-work/57748/2 "2022-03-29T12:19:47Z")

</div>

Thanks a lot Victor , it’s a magic . i just test and try to play with this trick .  
Thanks again

---

<div class="post-metadata">

**Author:** ![andrews](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@andrews](https://forum.inductiveautomation.com/u/andrews)\
**Post date:** [March 29, 2022, 6:11pm UTC](https://forum.inductiveautomation.com/t/iframe-dark-magic-dont-try-this-at-work/57748/3 "2022-03-29T18:11:46Z")

</div>

> [@victordcq](#):
>
> iframe src can render strings as html!

I didn't fully read but though this thread might be worthy of a read [Html code as IFRAME source rather than a URL - Stack Overflow](https://stackoverflow.com/questions/6102636/html-code-as-iframe-source-rather-than-a-url)

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [March 30, 2022, 6:49am UTC](https://forum.inductiveautomation.com/t/iframe-dark-magic-dont-try-this-at-work/57748/4 "2022-03-30T06:49:40Z")

</div>

Unfortunatly the things said in stackoverflow cant be used in perspective, as they require html/js access ☹
