IFrame with external application

Forum to discuss the new web client version of Servoy.

IFrame with external application

Postby rph » Fri Apr 29, 2022 3:40 pm

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
rph
 
Posts: 94
Joined: Wed Aug 10, 2011 11:44 am
Location: Cham, Switzerland

Re: IFrame with external application

Postby swingman » Thu Jul 07, 2022 10:37 am

I have the same problem.
Did you work out how to do this?
Christian Batchelor
Certified Servoy Developer
Batchelor Associates Ltd, London, UK
http://www.batchelorassociates.co.uk

http://www.postgresql.org - The world's most advanced open source database.
User avatar
swingman
 
Posts: 1479
Joined: Wed Oct 01, 2003 10:20 am
Location: London

Re: IFrame with external application

Postby rph » Thu Jul 07, 2022 10:58 am

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
rph
 
Posts: 94
Joined: Wed Aug 10, 2011 11:44 am
Location: Cham, Switzerland

Re: IFrame with external application

Postby jcompagner » Thu Jul 07, 2022 11:05 am

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.
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8884
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: IFrame with external application

Postby rph » Thu Jul 07, 2022 11:11 am

Hi Johan

That would be exactly what we need (and it's just what we get with the workaround that I've described above).
rph
 
Posts: 94
Joined: Wed Aug 10, 2011 11:44 am
Location: Cham, Switzerland

Re: IFrame with external application

Postby swingman » Fri Jul 08, 2022 12:02 pm

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.
Christian Batchelor
Certified Servoy Developer
Batchelor Associates Ltd, London, UK
http://www.batchelorassociates.co.uk

http://www.postgresql.org - The world's most advanced open source database.
User avatar
swingman
 
Posts: 1479
Joined: Wed Oct 01, 2003 10:20 am
Location: London


Return to Servoy NGClient

Who is online

Users browsing this forum: No registered users and 2 guests