# Passing data to an Inline Frame

**URL:** <https://forum.inductiveautomation.com/t/passing-data-to-an-inline-frame/25985>\
**Category:** Ignition Early Access\
**Tags:** perspective\
**Created:** [June 20, 2019, 3:12pm UTC](https://forum.inductiveautomation.com/t/passing-data-to-an-inline-frame/25985 "2019-06-20T15:12:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![md.szyman](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/md.szyman/32/9240_2.png) [@md.szyman](https://forum.inductiveautomation.com/u/md.szyman)\
**Post date:** [June 20, 2019, 3:12pm UTC](https://forum.inductiveautomation.com/t/passing-data-to-an-inline-frame/25985/1 "2019-06-20T15:12:48Z")

</div>

Is it possible to pass data from the perspective session into an Inline Frame? Does the page inside the inline frame have access to the `custom` properties or anything? There’s nothing in the documentation about this and I’m just wondering if it’s possible at all.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [June 20, 2019, 3:29pm UTC](https://forum.inductiveautomation.com/t/passing-data-to-an-inline-frame/25985/2 "2019-06-20T15:29:19Z")

</div>

No, the inline frame is just a “portal” of sorts and has no insight into the fact that it’s within a page/view. If you want to pass parameters, you could conceivably construct a url as the inline frame source which has the expected parameters.

---

<div class="post-metadata">

**Author:** ![md.szyman](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/md.szyman/32/9240_2.png) [@md.szyman](https://forum.inductiveautomation.com/u/md.szyman)\
**Post date:** [June 20, 2019, 3:29pm UTC](https://forum.inductiveautomation.com/t/passing-data-to-an-inline-frame/25985/3 "2019-06-20T15:29:48Z")

</div>

As you were typing this response I thought of how I could do it, and that would be dynamically generating a source URL with a binding and then using that to pass parameters/data.

Thanks!

---

<div class="post-metadata">

**Author:** ![md.szyman](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/md.szyman/32/9240_2.png) [@md.szyman](https://forum.inductiveautomation.com/u/md.szyman)\
**Post date:** [June 20, 2019, 3:49pm UTC](https://forum.inductiveautomation.com/t/passing-data-to-an-inline-frame/25985/4 "2019-06-20T15:49:45Z")

</div>

If anyone is curious, the solution I’m doing is this, it seems to be one of the only ways to do this, and might not be the best.

1. Create a `data` object in the `custom` properties for the IFrame.
2. Store all data you want to send into the IFrame in this object.
3. Set the `src` property to a property binding bound to that `data` property with a Script transform set like this:

```python
import base64
	
base_url = "http://localhost:8080/?data="
data_str = str(value)
return base_url + data_str

```

This encodes the `data` property as base64 and throws it into the query string under the `data` key. This can then be accessed in the page in JavaScript:

```auto
var urlParams = new URLSearchParams(window.location.search);
var b64data = urlParams.get('data');
var data = JSON.parse(atob(b64data));

```

and `data` is now a JavaScript object that is equal to the `data` passed in from the Perspective view!

---

<div class="post-metadata">

**Author:** ![Kevin\_DLeon](https://avatars.discourse-cdn.com/v4/letter/k/c4cdca/32.png) [@Kevin\_DLeon](https://forum.inductiveautomation.com/u/Kevin_DLeon)\
**Post date:** [May 4, 2021, 2:48pm UTC](https://forum.inductiveautomation.com/t/passing-data-to-an-inline-frame/25985/5 "2021-05-04T14:48:50Z")

</div>

Hello,

with this method could you retreive data as well? i mean; im with a localhost page as well and i want to get the final navigated url but the src is binded to the root url

---

<div class="post-metadata">

**Author:** ![Resistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/resistor/32/30634_2.png) [@Resistor](https://forum.inductiveautomation.com/u/Resistor)\
**Post date:** [January 11, 2023, 5:16pm UTC](https://forum.inductiveautomation.com/t/passing-data-to-an-inline-frame/25985/6 "2023-01-11T17:16:36Z")

</div>

Hello, I know it has been a while since you posted this, but could you give an example of how to implement this part

> [@md.szyman](#):
>
> This can then be accessed in the page in JavaScript

I want to enter a password inside an inline frame embedded website, but I can't figure out how

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

or should I make a new post?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 11, 2023, 5:27pm UTC](https://forum.inductiveautomation.com/t/passing-data-to-an-inline-frame/25985/7 "2023-01-11T17:27:34Z")

</div>

> [@Resistor](#):
>
> but I can't figure out how

Because browsers don't permit this.

The technique in this post places information in the URL, which the site content inside the frame could use for arbitrary purposes. But the inner site has to do it. You can't push anything into the inner's site's DOM from outside.
