You are not logged in.

1

Thursday, June 24th 2021, 12:34am

Close iFrame from pano shown within the iFrame

Hi All,

I have been trying to get this to work for several days. I have an iFrame that displays a pano. The pano has a hotspot (Yellow A) in it. I am trying to set up an "onclick" that closes the iFrame window.

I am using a modified version of one of the example for testing:
https://s3.us-west-1.amazonaws.com/steel…Test/index.html

I have tried several things, but I can't figure out how to call the 'pop_close action in the base XML file. Is this the right way, or is there a better method to close this iFrame window?

Here is the onclick code that I am trying for the Yellow A hotspot:

Source code

1
onclick="document.getElementById('krpanoSWFObject').call('popup_close()');


Here is the action I am trying to the hot spot to run:

Source code

1
2
3
4
5
6
7
8
9
10
	<action name="popup_close">
		set(global.plugin[popup_bg].enabled, false);
		set(global.events[popup].name, null);
		tween(global.plugin[pp_blur].range, 0.0);
		tween(global.layer[popup_bg].bgalpha, 0.0, 0.25);
		tween(global.layer[popup].alpha, 0.0, 0.25, default,
		removelayer('popup_bg', true);
		scope(private:POPUP, delete(popup); );
		);
	</action>


Many thanks for your help, or for pointing me in the right direction,
Travis

light_line

Intermediate

Posts: 168

Occupation: krpano freelancer || creating ideas & coding them || krpano developer

  • Send private message

2

Friday, July 23rd 2021, 2:33pm

Hi Tavis,

If I understood correctly, you are trying to close a popup in the Krpano environment from the parent of the Iframe. right?
If I am right, you can use the "Window.postMessage()" function to communicate between the iframe and its parent.
You can read the documentation here:
https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage



Best,
Hamid