470,618 Members | 1,723 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,618 developers. It's quick & easy.

Hard to find problem for specialists !

Hello,

Here is a hard problem i cannot solve about window.opener method
I think you'll need to be a specialist to find the solution... i can't find
the solution by myself ! Please help me.
Here is the problem (quiet complicated to explain).

I use two differents servers with two IIS 4.0 Web servers

On the first one (let's name it Server1) i got my web site. On my web site,
i have a page (A.html) that calls (in javascript) a new window that loads a
PHP script that remains on the second server. Are you following me ?

On the second server (let's name it Server2) there is the so-called PHP
script "lookfor.php" that browse the system file of my server (of course i
needed to implement IIS and a virtual web site for it to work).

Let's recapitulate :

So in the A.html page on server1 there is a form (form1) with a field
(filed1) to be filled by an entry selected with lookfor.php. The call to the
script lookfor is done thanks to window.open (below) :

OnClick="javascript:winexp=window.open('http://server2/lookfor.php', ....);
winexp.parent=self;" ...

in the lookfor.php script (resident on Server2) there is a javascript code
as below that should fill field1 on the form1 of the opener window
window.opener.form1.field1.value=fileselectedbyuse r;

AND NOW... THE PROBLEM...

here is the question
When both the page and the script are on the same server, this is running
perfectly but if i use 2 servers as discribed up the field is never filled.
It seems as if window.opener.form1.field1.value=fileselectedbyuse r; makes an
exception a terminate the code (and the field1 is not filled). It also seems
as if the object Windows.opener doesn't exists !

Do you really think that it is a problem of 2 servers ? Is it possible to
make it run ? Did i forget a piece of code ?

Hope i was clear and you'll be able to help me. I can send you the code if
you need it !

Many thanks for yout help
Fabrice

PS : Please excuse my bad english.
Jul 20 '05 #1
2 1444
Fabrice Labrousse wrote:
Hello,

Here is a hard problem i cannot solve about window.opener method
I think you'll need to be a specialist to find the solution... i can't find
the solution by myself ! Please help me.
Here is the problem (quiet complicated to explain).

I use two differents servers with two IIS 4.0 Web servers

On the first one (let's name it Server1) i got my web site. On my web site,
i have a page (A.html) that calls (in javascript) a new window that loads a
PHP script that remains on the second server. Are you following me ?

On the second server (let's name it Server2) there is the so-called PHP
script "lookfor.php" that browse the system file of my server (of course i
needed to implement IIS and a virtual web site for it to work).

Let's recapitulate :

So in the A.html page on server1 there is a form (form1) with a field
(filed1) to be filled by an entry selected with lookfor.php. The call to the
script lookfor is done thanks to window.open (below) :

OnClick="javascript:winexp=window.open('http://server2/lookfor.php', ....);
winexp.parent=self;" ...

in the lookfor.php script (resident on Server2) there is a javascript code
as below that should fill field1 on the form1 of the opener window
window.opener.form1.field1.value=fileselectedbyuse r;

AND NOW... THE PROBLEM...

here is the question
When both the page and the script are on the same server, this is running
perfectly but if i use 2 servers as discribed up the field is never filled.
It seems as if window.opener.form1.field1.value=fileselectedbyuse r; makes an
exception a terminate the code (and the field1 is not filled). It also seems
as if the object Windows.opener doesn't exists !

Do you really think that it is a problem of 2 servers ? Is it possible to
make it run ? Did i forget a piece of code ?


You are running into the Same Source Rule. The windows can only interact
if they were served from the same domain. You can get around it by
putting this in a script in the head of all documents:

document.domain = "common.com"

If you do that, then windows from server1.common.com and
server2.common.com can interact.

http://www.crockford.com/#javascript
Jul 20 '05 #2
Douglas,

thank you very much for your help... i didn't know this method. I ran it
with success. All is important to note is that there mus be a equal suffix
in the domain name for it to work.

Regards.
Fabrice

"Douglas Crockford" <no****@covad.net> a écrit dans le message news:
78***************************@msgid.meganewsserver s.com...
Fabrice Labrousse wrote:
Hello,

Here is a hard problem i cannot solve about window.opener method
I think you'll need to be a specialist to find the solution... i can't find the solution by myself ! Please help me.
Here is the problem (quiet complicated to explain).

I use two differents servers with two IIS 4.0 Web servers

On the first one (let's name it Server1) i got my web site. On my web site, i have a page (A.html) that calls (in javascript) a new window that loads a PHP script that remains on the second server. Are you following me ?

On the second server (let's name it Server2) there is the so-called PHP
script "lookfor.php" that browse the system file of my server (of course i needed to implement IIS and a virtual web site for it to work).

Let's recapitulate :

So in the A.html page on server1 there is a form (form1) with a field
(filed1) to be filled by an entry selected with lookfor.php. The call to the script lookfor is done thanks to window.open (below) :

OnClick="javascript:winexp=window.open('http://server2/lookfor.php', .....); winexp.parent=self;" ...

in the lookfor.php script (resident on Server2) there is a javascript code as below that should fill field1 on the form1 of the opener window
window.opener.form1.field1.value=fileselectedbyuse r;

AND NOW... THE PROBLEM...

here is the question
When both the page and the script are on the same server, this is running perfectly but if i use 2 servers as discribed up the field is never filled. It seems as if window.opener.form1.field1.value=fileselectedbyuse r; makes an exception a terminate the code (and the field1 is not filled). It also seems as if the object Windows.opener doesn't exists !

Do you really think that it is a problem of 2 servers ? Is it possible to make it run ? Did i forget a piece of code ?


You are running into the Same Source Rule. The windows can only interact
if they were served from the same domain. You can get around it by
putting this in a script in the head of all documents:

document.domain = "common.com"

If you do that, then windows from server1.common.com and
server2.common.com can interact.

http://www.crockford.com/#javascript

Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Erich Keane | last post: by
2 posts views Thread by =?Utf-8?B?R2VvcmR5?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.