Closed Bug 127181 Opened 23 years ago Closed 23 years ago

JavaScript not working retrieving variable from window.opener

Categories

(Core :: DOM: Core & HTML, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: jgordon00, Assigned: jst)

References

()

Details

Attachments

(1 file)

This is a bit tricky to explain, but I will try my best. I have a Flash 5 portfolio site with a section called Photography. When that loads, there is a button that says "View Photo", which when pressed, launches a pop-up window through the following script (which is on the page where the flash movie is embedded): <script language="javascript"> var win = null; var picVar1 = null; function newWindow(mypage,myname,w,h,scroll,picName){ LeftPosition = (screen.width) ? (screen.width-w)/2 : 0; TopPosition = (screen.height) ? (screen.height-h)/2 : 0; settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable' picVar1 = picName; win = window.open(mypage,myname,settings) if(javascript_version > 1.0) { //delay for IE4 new window error setTimeout('win.focus();',250); } } </script> Now, the part of that script that makes it different from an ordinary pop-up window script is the last argument in the newWindow function --- picName. What picName is for is a means for flash to pass a variable from whatever pic is being viewed in the site to the new pop-up window, so that code is dynamically written (using document.write) depending on which picture it is. So -- to step you through the process: 1) Go to joshgordondesign.com 2) Enter site 3) Once main site loads, click photography 4) Once that loads, click View Photo (the first photo is fine...) 5) A pop-up window will launch that SHOULD show the image. BUT -- in Mozilla it does not. It does in every other recent browser I've tried (Netscape 4.79, IE 5,6, Opera 6.01, etc...) If you look at the source for that pop-up window, you can see what I am doing. I am retrieving the picVar1 variable (which is defined as picName in the script) from the window.opener and then using that in the document.write script to write the name of the image to the img src line. For some reason, in Mozilla, the variable is not being passed from the window.opener and as a result, the picVar2 (which is actually the picName argument from the pop-up window script) is undefined. Please have a look and try it in Netscape 4.79 also so you can see that it does work. Let me know if you have any questions. Thanks.
Browser, not engine ---> DOM Level 0
Assignee: rogerl → jst
Component: JavaScript Engine → DOM Level 0
QA Contact: pschwartau → desale
Actually, this WORKSFORME with Mozilla trunk 2002022009 WinNT. I get the warning alertbox, "This may not work in Mozilla/N6", but after I dismiss that, each photo loads fine in the popup window. I'm only seeing this one error in the JavaScript Console from the site: Error: javascript_version is not defined Source File: http://www.joshgordondesign.com/flashsite.html Line: 17 This also WORKSFORME using Mozilla 2002022208 on Linux. Let me mark this bug as WORKSFORME - Josh, what build date are you using? Is the bug still present in the latest builds? If not, please mark this bug "Verified". If it is still present, however, you can reopen the bug; thanks - (In which case, what errors from your site, if any, appear in Tasks > Tools > JavaScript Console?)
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: