/    Sign up×
Community /Pin to ProfileBookmark

sending data accross windows

I ran into an interesting problem with a script. What it does is open a window and send a value to a variable in the new opened window

[code]
win=window.open(“something.htm”, “”, “theatermode”);
win.nums=1;
[/code]

now here’s the weird part. the script works perfectly on my computer, but when i put it on the internet it doesn’t work.

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@phpnoviceMar 06.2006 — Possibly because of a delay in loading the document into the popup window. Or, perhaps because of cross-domain scripting. Yes? There is no delay and no domain involved when both documents are on your computer.
Copy linkTweet thisAlerts:
@PhalonauthorMar 06.2006 — well the part about the window delay i already have covered. i put in a .5 second delay in the window, because it was needed when i used it on my computer. i am curious what you mean by cross-domain scripting and if i need to contact my website provider about it
Copy linkTweet thisAlerts:
@phpnoviceMar 06.2006 — Cross-domain issues are only involved if the two documents each come from two different websites. As for the delay... Adding a delay can actually hurt -- not help -- but it depends upon where you added the delay and where, exactly, the error is occurring. You didn't really say what, exactly, "doesn't work."
Copy linkTweet thisAlerts:
@PhalonauthorMar 06.2006 — Well I'll try to answer everything in this post:
<i>
</i>win=window.open("picslide.htm", "", "theatermode, height=600, width=700");
win.nums=1;

I use this to open the window and send the variable.

then on the picslide.htm i use
<i>
</i>&lt;body bgcolor="black" onLoad="Javascript:setTimeout('start()', 500);"&gt;

to delay calling the function because otherwise the varabile comes up as "undefined" when i tested on my computer. i also used various delay times to see if i didn't have it wait long enough to check the variable's value. but no luck. This is all at the same website and this isn't the first page to do this. Also i did try it with no delay and it still comes back with the same, nums is "undefined". For the full page, its at www.marshallareastagecompany.org/home.htm

This is just a test site before it gets it's own domain, and yes i'm the webmaster of the site space im testing this at (just in case that might be an issue).

*note- to open the page, scroll down, and click on one of the numbers on the picture of the golf course.
Copy linkTweet thisAlerts:
@phpnoviceMar 06.2006 — I see. Well, the delay is actually needed between these two statements:
<i>
</i>win=window.open("picslide.htm", "", "theatermode, height=600, width=700");
win.nums=1;

This is because, while the window is opening, it is unavailable to script references. So, try this and increase yoru other delay, too:
<i>
</i>win=window.open("picslide.htm", "", "theatermode, height=600, width=700");
window.setTimeout("win.nums=1", 500);
×

Success!

Help @Phalon 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.26,
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,
)...