Navigating the provider?

156 views
Skip to first unread message

ram

unread,
Jun 6, 2012, 6:57:48 AM6/6/12
to easyxdm, ramt...@pelephone.co.il, r...@ibooqu.co.il
Hello,

Thanks for your plugin. I need to get something clear about it.

In the FAQ, you write:

"Due to security measures in place (this is for your own, and your
users protection) the provider can not be navigated without severing
the connection, and this cannot be re-established. If you require the
need to navigate the content displayed in the iframe then you should
use a nested approach ..."

What I found when testing your plugin in that navigating the provider
(which I need) doesn't work at all. It's not that you navigate but
lose the connection. You just cannot navigate at all. Is this supposed
to happen?

e.g. I tried to get the consumer to cause the provider to submit a
form. When the target of the form was the same page, the submit
worked, and then the connection was lost. But when the target of the
form was another page, it just didn't work. The other page was not
displayed in the iframe.

If there's a way to navigate the iframe (losing the connection isn't a
problem), I'd like to know about it. The "nested approach" is not
appropriate in my case.

Thanks in advance,
Ram

Øyvind Sean Kinsey

unread,
Jun 6, 2012, 12:04:39 PM6/6/12
to eas...@googlegroups.com

In this case you must be doing something wrong,  because this is a pretty simple use case (look at the resize iframe and upload examples), but without any code it's impossible to say what.

ram

unread,
Jun 7, 2012, 3:47:18 AM6/7/12
to easyxdm
Hi,
So I append the code, below (these are two ASPX files, based on your
examples). Do I do something wrong?

Notice that the <form> in the provider affects a redirect to a
Wikipedia page. When I initiate the form-submit from inside the
iframe, or via direct call from the parent (when the provider and the
consumer reside on the same domain), the redirect works. But when I
initiate the form-submit via easyXDM, the redirect doesn't work.
Actually one can then see in the browser's status bar that the
Wikipedia page is being loaded, but it doesn't get displayed inside
the iframe. The iframe's displayed contents do not change.

Thanks in advance,
Ram

===== consumer =====

<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="GuestRegistrationNew.aspx.cs"
Inherits="Login.GuestRegistrationNew" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Musix - Registration</title>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="easyXDM.min.js">
</script>

<script type="text/javascript">
function submitChild() {
//alert(myFrame);
var childForm = myFrame.document.getElementById("form1");
//alert(childForm);
childForm.submit();
}
function XDMsubmitChild() {
socket.postMessage("submit");
}
</script>

<script type="text/javascript">
var socket;
$(document).ready(function () {
socket = new easyXDM.Socket({
remote: "http://localhost:41628/CreditCardLP.aspx",
onMessage: function (message, origin) {
alert("Received '" + message + "' from '" + origin
+ "'");
var elem = document.getElementById("p1");
// alert("trying to modify text element " + elem);
elem.innerHTML = message;
},
onReady: function () {
socket.postMessage("Yay, it works!");
}
});
});


</script>
</head>
<body class="divBackgroundH920">
<form id="Form1" runat="server" autocomplete="off" startup="true">
<div>
<iframe src="http://localhost:41628/CreditCardLP.aspx" name="myFrame"
id="myFrame" scrolling="auto" width="300" height="300" >Your browser
does not seem to support frames</iframe>
</div>
</form>
<br><br>
<button onclick="submitChild()">Submit child (directly)</button>
<br><br>
<button onclick="XDMsubmitChild()">Submit child (via easyXDM plugin)</
button>
<div id="p1">The message will be written in here</div>
</body>
</html>


===== provider =====

<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="CreditCardLP.aspx.cs" Inherits="WebMusix.CreditCardLP" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="easyXDM.min.js">
</script>
<script type="text/javascript">
var socket;
socket = new easyXDM.Socket({
onMessage: function (message, origin) {
alert("Received '" + message + "' from '" + origin +
"'");
var elem = document.getElementById("ppp");
alert("trying to modify text element " + elem);
elem.innerHTML = message;
//$("#ppp").html(message);
if ("submit" == message) {
//alert("special: trying to redirect");
//document.location.href = "http://
www.ynet.co.il";
//
var myForm = document.getElementById("form1");
alert("trying to submit the form " + myForm);
socket.postMessage("Father, I now submit");
//myForm.action = "http://www.ynet.co.il";
myForm.submit();
} else {
socket.postMessage("Indeed it does!");
}
}
});


</script>
<script type="text/javascript">
var tokenId = "<%# TokenId %>";
$(document).ready(function () {
/// send token up;
});

</script>
</head>
<body>
<p id="ppp">some text</p>
<form id="form1" name="form1" action="http://en.wikipedia.org/wiki/
Phases_of_Venus" onsubmit='alert("going to submit")'>
<input type="hidden" name="shmutzy" value="y"/>
<input type="submit" value="Submit"/>
</form>
</body>
</html>

=================

Øyvind Sean Kinsey

unread,
Jun 7, 2012, 9:59:21 AM6/7/12
to eas...@googlegroups.com

Do not create the iframe yourself, easyXDM will do this. Use the container property to control where it is rendered - its currently hidden.

Ram Tobolski

unread,
Jun 10, 2012, 3:57:35 AM6/10/12
to easyxdm
You're right, of course. Thanks
Reply all
Reply to author
Forward
0 new messages