PDA

View Full Version : Parent/Child Windows - Passing Parameters


mwetzel
10-15-2002, 09:04 PM
Hopefully this is a simple question. I know its possible for a child window to read the values from the fields of the parent window. My javascript works fine until today. I added a new twist. The parent window runs on one web server and the child on a second, but the javascript is returning errors when I attempt to read a field values from the parent.

Code:
<script language=Javascript>
alert(opener.document._ctl1.elements['ShipFirstNamefld']);
if (document.forms[0].Ref.value = 3) {
//if (opener.document._ctl1.elements['ShipFirstNamefld'] == null) {

It errors on the alert line now. Access is denied. Is it a no-no to use javascript across servers? or is this a server permission level problem?

Thanks

mordred
10-15-2002, 09:35 PM
AFAIK this is security measure of JavaScript. Normally, all requests to access content from different servers is denied. The idea behind is that nasty things like pop-up windows from ad servers don't track what's going on the parent windows (after you left the site that launched the popup).

The implementation of this measure varies although. Some browser versions are very restrictive in handling this, I recall IE (but am not 100% sure) to restrict you acces to scripts that come from the same server, but from different subdomains... well, I hope that clarifies things for you at least a little bit. It could well be that you have to put the script on the same server to get it working fast.

beetle
10-15-2002, 11:29 PM
You could pass the form values to the popup using this (http://www.codingforums.com/showthread.php?s=&threadid=4555&highlight=parseGetVars)