# IFrame with external application

**URL:** <https://forum.servoy.com/t/iframe-with-external-application/20750>\
**Category:** Questions\
**Created:** [April 29, 2022, 1:40pm UTC](https://forum.servoy.com/t/iframe-with-external-application/20750 "2022-04-29T13:40:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rph](https://avatars.discourse-cdn.com/v4/letter/r/c2a13f/32.png) [@rph](https://forum.servoy.com/u/rph)\
**Post date:** [April 29, 2022, 1:40pm UTC](https://forum.servoy.com/t/iframe-with-external-application/20750/1 "2022-04-29T13:40:41Z")

</div>

Hi

I’ve got the following situation: In our application, we work with an external application (website). The communication between the two applications goes over RabbitMQ.

The external application should be shown within an IFrame. So I abuse the “EmbeddedYouTube”-component. This works, so far. But when I switch to another form of our application and come back to the form where the external application is shown, then the external url seems to be reloaded again. So I am always on the start-page of the external app when the form is shown.

Is there a workaround or maybe a better component/approach to achive this.

Best regards  
Roland

---

<div class="post-metadata">

**Author:** ![swingman](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/swingman/32/4536_2.png) [@swingman](https://forum.servoy.com/u/swingman)\
**Post date:** [July 7, 2022, 8:37am UTC](https://forum.servoy.com/t/iframe-with-external-application/20750/2 "2022-07-07T08:37:32Z")

</div>

I have the same problem.  
Did you work out how to do this?

---

<div class="post-metadata">

**Author:** ![rph](https://avatars.discourse-cdn.com/v4/letter/r/c2a13f/32.png) [@rph](https://forum.servoy.com/u/rph)\
**Post date:** [July 7, 2022, 8:58am UTC](https://forum.servoy.com/t/iframe-with-external-application/20750/3 "2022-07-07T08:58:20Z")

</div>

I just have a “ugly” workaround, but it works for us. The problem is obiously, when onShow is executed then the URL of the “src”-attribute of the IFrame will be called and so you have always the initial state of the external website.

So here is my workaround:

I’ve open a dialog-form (not modal) and on this form there is the youtube-component with the url. I remove the “Close”-Button of the dialog with CSS and instead I’ve put my own “close”-Button on this form. My close-button doesn’t really close the dialog form but sent it to a position where it isn’t visible any more (x = -10000, y = -10000) and before I send it to this position I store the original position somewhere (form-variable or elsewhere). So when the user clicks on my new close-button it looks to him as the form is hidden and he could work on other forms in my application. As soon as he wants to come back to the external app the hidden form comes back to the original position that I have stored previously. This way the “onShow” will not be executed and so the users sees exactly the state of the external application as it was when he “closed” it.

Hope this helps. If you want some code example, let me know.

Best  
Roland

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [July 7, 2022, 9:05am UTC](https://forum.servoy.com/t/iframe-with-external-application/20750/4 "2022-07-07T09:05:51Z")

</div>

but this is kind of logical  
when you move away from the component with the iframe.  
The iframe will be destroyed and if you go back it will be recreated again…  
So depending on if there is still a session or how that internal application behaves it will be brand new again.

If you really want to keep the full state, you need to write a more complex component  
that injects the iframe to the body of the page (so not the component) and leaves it there even after itself is destroyed (and making the iframe display:none)  
then when the components is shown again, it searches for that iframe and if it is there, it will redisplay again.

---

<div class="post-metadata">

**Author:** ![rph](https://avatars.discourse-cdn.com/v4/letter/r/c2a13f/32.png) [@rph](https://forum.servoy.com/u/rph)\
**Post date:** [July 7, 2022, 9:11am UTC](https://forum.servoy.com/t/iframe-with-external-application/20750/5 "2022-07-07T09:11:54Z")

</div>

Hi Johan

That would be exactly what we need (and it’s just what we get with the workaround that I’ve described above).

---

<div class="post-metadata">

**Author:** ![swingman](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/swingman/32/4536_2.png) [@swingman](https://forum.servoy.com/u/swingman)\
**Post date:** [July 8, 2022, 10:02am UTC](https://forum.servoy.com/t/iframe-with-external-application/20750/6 "2022-07-08T10:02:20Z")

</div>

Thanks Roland,

I think I can solve my problem in a similar way to your workaround.

@jcompagner: I would be good to have a component for showing external pages inside a Servoy solution.
