/    Sign up×
Community /Pin to ProfileBookmark

"Opener" Problem

Hi,

This is strange – since the script already worked before. I have a widow A with the following js function:

[CODE]
function newWindow(file,window) {
msgWindow=open(file,window,’resizable=no,scrollbars=yes,width=600,height=400′);
if (msgWindow.opener == null) msgWindow.opener = self;
}
[/CODE]

And one link in that page:

[CODE]
<a href=”javascript:newWindow(‘../cgi-bin/calc/calc.pl’,’windowB’);” >Calculate</a>
[/CODE]

Ok: if I click the link a new window will open, B, with a perl script to performe some calculations. After these calculations, the results are placed in a table, each other with a link:

[CODE]
<a href=”#” onclick=”javascript:data(data1,data2);window.close()” >
[/CODE]

and the following function is in the header:

[CODE]
function data (data1,data2){
if (parent.frames.length != 0) {
// loaded in frames
}
else {
opener.document.form.var1.value=data1;
opener.document.form.var2.value=data2;}
[/CODE]

The problem is that I get always an error in this last function, data – access denied.

Does anyone knows why?

Kind regards,

Kepler

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@Mr_JJan 15.2006 — It could be that you are closing the window before the function has finished, remove the window.close() and see if you still get the error
Copy linkTweet thisAlerts:
@keplerauthorJan 16.2006 — Hi,

If I remove the window.close() the same result happens. I included - after that teste - the line

(opener) ? alert('Opener is here.') : alert('Nope, no opener around.');

that tells me that the opener is there.

I can't figure this out.

Kepler
Copy linkTweet thisAlerts:
@Mr_JJan 16.2006 — Can you post a url to a working example?
Copy linkTweet thisAlerts:
@keplerauthorJan 18.2006 — Thanks. The problem is that the pages are in portuguese...well, go to http://cosmos.com.pt/ephem/ephem.html please, go down until you find the link "Concultar o Atlas do Cosmos". Press it, and a window will open. There, enter in the text box a name of a city - like Porto - and press "Procurar na base de dados". You'll get some results - each one has a hyperlink. If you press one it should pass the value to the main window, and close the window with the results.

Kepler
Copy linkTweet thisAlerts:
@Mr_JJan 18.2006 — Tried your link but got "Page not found"
×

Success!

Help @kepler spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.27,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...