Can a Child Page Loaded into an Iframe tell that Iframe to Load Something Else?

Discussion in 'HTML & Website Design' started by Captain_Ambiguous, Nov 22, 2011.

  1. #1
    Practically speaking I mean. I've already seen that it can but it seems limited.

    I'm working on a desktop gadget for my company and one of the major components is a large iframe called "VIEWER". VIEWER will load up various menus inside it and depending on the selection it will then swith to look at a particular picture. I found early on that when I coded it to open the picture I want I just end up with a "Navigation Has Been Cancelled" message inside the iframe. That picture is around 100kb and I've since found that small pictures such as 38kb will load up just fine.

    I suspected it was failing because the code was effectively deleting itself before the picture had time to load up. So I changed things so that the actual picture change is executed by a function in the parent window instead of the child code in the iframe. Still no luck though.

    This is the simple function residing in the parent window:

    function viewerchange(path)
    {
    document.getElementById('VIEWER').src=path
    }

    And here is the hyperlink in the child window inside the iframe:

    <a href="javascript:void(null)" onclick="parent.viewerchange('image.jpg')">LINK</a>


    Like I said this works just fine with smaller image files but not with the final versions I want it to use. Any ideas? I'd appreciate it.
     
    Captain_Ambiguous, Nov 22, 2011 IP
  2. Captain_Ambiguous

    Captain_Ambiguous Active Member

    Messages:
    66
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    95
    #2
    Never mind, when I specified the image path to the viewerchange function I forgot that the function was running from a different directory.

    So the only reason those smaller images DID load is because they happened to exist in both directories :p
     
    Captain_Ambiguous, Nov 23, 2011 IP