Skip to content
This repository has been archived by the owner on Apr 20, 2023. It is now read-only.

multiple remote #266

Open
seaapple opened this issue Dec 12, 2015 · 1 comment
Open

multiple remote #266

seaapple opened this issue Dec 12, 2015 · 1 comment

Comments

@seaapple
Copy link

Hello,

How can I send resize information to the same iframe from two web pages? it seems that the "remote" url variable needs to be hard coded at setup time.

I'm using easyXdm socket to resize an iframe. It seems to be working on first load of the page. But I can't get it to resize when a new link is clicked from inside the iframe. Specifically when a user switches from a calendar view at 800 px high to a list view which might be 3000px high. So the new url might go from http://www.mysite.com/calendar_view/ to http://www.mysite.com/list_view/
Both pages will send back the hight information for the resize. That part is working. The problem is that the setup for the page has the remote variable hard set to http://www.mysite.com/calendar_view/ when the socket is created. So it will ignore messages sent from http://www.mysite.com/list_view/

var calendar_setup = {
remote: "http://www.mysite.com/calendar_view/",
container: document.getElementById("iframeContainer"),
onMessage: function(message, origin){
alert('test.page got the message from calendar' + message);
this.container.getElementsByTagName("iframe")[0].style.height = message + "px";
this.container.getElementsByTagName("iframe")[0].style.width = "800px";
}
};

var calendar_socket = new easyXDM.Socket(calendar_setup);
var runSocketMessenger = function() { calendar_socket.postMessage(); }

@oyvindkinsey
Copy link
Owner

You'll need to use an intermediary, or sibling frame to allow this - a
search on this list should yield several examples I think. Sibling is
definitely best, with your child page calling
parent.xdmiframename.resizeMe. that way the xdm frame is persistent while
your visible frame changes.

On Fri, Dec 11, 2015, 11:18 PM seaapple [email protected] wrote:

Hello,

How can I send information to the same iframe from two web pages, when the
"remote" url variable is hard coded at setup time?

I'm using easyXdm socket to resize an iframe It seems to be working on
first load of the page But I can't get it to resize when a new link is
clicked from inside the iframe Specifically when a user switches from a
calendar view at 800 px high to a list view which might be 3000px high So
the new url might go from http://wwwmysitecom/calendar_view/ to
http://wwwmysitecom/list_view/

Both pages will send back the hight information for the resize That part
is working The problem is that the setup for the page has the remote
variable hard set to http://wwwmysitecom/calendar_view/ when the socket
is created So it will ignore messages sent from
http://wwwmysitecom/list_view/


Reply to this email directly or view it on GitHub
#266.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants