How To: Popup Website A from Website B?

  • Thread starter Thread starter svd
  • Start date Start date
S

svd

Hi all,

First off, I'm developing in VB.NET 2003.

I would like to have a button on Company A's web page display Company B's
web page in a popup window. It needs to pass a serialzed class object to the
popup web page, which can be picked up in its pageload() hander. Further,
closing the popup should return a serialized class object. I'm fine with the
serialization part, just confused over the popup and passing data part.

I think this can only be accomlished using javascript and a hidden field on
each web page. I tried a number of examples, but could never get any of them
to run properly.

Any help would be greatly appreaciated.

Thanks,

Steve
 
Okay, an example with no fluff. The extra bits in the other example are
there to allow your two pages to vary independently of one another. I
had the situation where I had to open several windows from the first
page, and used different callback functions for those windows.

Company A:
<html>
<head>
<script type="text/javascript">
var serializedObject = {Foo:"Foo", Bar:"Bar"};
var myChild;

function getInitializationObject(){ return serializedObject; }

function receiveObject(data) {alert("received :"+data);}

function openWindow(){myChild = window.open("companyB.htm");}
</script>
</head>

<body>
<input type="button" value="Talk to Company B" onclick="openWindow()"
/>
</body>
</html>

----------------

Company B:

<html>
<head>
<script type="text/javascript">

function sendValue()
{
var result = {result:
document.getElementById("senderBox1").value};
this.opener.receiveObject(result);
}

function Handshake()
{
var initObject = this.opener.getInitializationObject();
alert("received :"+initObject);
}
</script>
</head>
<body onload="Handshake()">

<input type="text" id="senderBox1" />
<input type="button" onclick="sendValue()" value="send value" />
</body>
</html>
 
Back
Top