[thelist] JS/DOM: Image doesn't load in remote window

Frank lists at frankmarion.com
Fri Sep 24 15:33:09 CDT 2004

At 10:14 AM 2004-07-15, you wrote:
>I can't guarantee this will fix your problem, but when performing action 
>between a popup and the opener, due to security restrictions, I don't 
>think you can change variables between the windows. So if you want Page A 
>to open Page B and then do some things in Page B, you will have to create 
>a function in Page B to do those things, and simply call the function from 
>Page A. Something like this: [snip]

Thanks, you set me in the right direction (no pun intended).

The trick was not to send a value from caller to remote, but rather to get 
the remote to retrieve a value set by the caller.

Here's my solution:

    Calling page: Set a value; in this case it's 'obj' - an image retrieved by
         <td onclick="propImgView(this);">

function propImgView(obj) {

    // This is the important part
       image = obj.childNodes.item(0).src

    // New window
       win_props = 'toolbar=no,location=no,directories=no,status=no,'
           remote = 


    Remote page: Retrieve the value set by the caller
function makeImage(image) {

    // Create an image object in the remote window, set it's id and source
       r = document.createElement("img");

    // Append it to the body
       b = document.getElementsByTagName("body").item(0)


//  This is where we retrieve the value set by the function in the calling 
    onload = makeImage(opener.image);

Note that this script must be placed *after* the body tag in order to work. 
I welcome any enhancement suggestions.

Frank Marion     lists at frankmarion.com      Keep the signal high.

More information about the thelist mailing list