How To: Popup Website A from Website B?

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
 
F

Flinky Wisty Pomm

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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top