SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict fabrizio's Avatar
    Join Date
    Oct 2002
    Location
    California
    Posts
    365
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to reload iframe content from a pop-up window?

    Hello,
    I have a main webpage with an iframe embedded inside:

    PHP Code:
    <IFRAME id="imagesframe" src="images_frame.php" width="100%"></IFRAME
    Now, I want to be able to reload the content of that iframe from a pop-up window. I tried the following JavaScript command inside the pop-up window:

    PHP Code:
    opener.document.getElementById("imagesframe").location.reload(); 
    but when I call that command i get the following JavaScript error:

    opener.frames.imagesframe has no properties
    Any idea? How to fix that?

    Thank you for any advice.

    Best,
    Fab.
    Virtual Sheet Music®, Inc.
    http://www.virtualsheetmusic.com
    Musicians Page
    http://www.musicianspage.com

  2. #2
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,117
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)
    Perhaps this may work?

    Code JavaScript:
    window.opener.document.getElementById("imagesframe").location.reload();

  3. #3
    SitePoint Addict fabrizio's Avatar
    Join Date
    Oct 2002
    Location
    California
    Posts
    365
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I found the following solution working fine:

    1. Added a "NAME" attribute to IFRAME tag called "imagesframe"

    2. Entered the following command in the JavaScript code of the popup window:

    opener.imagesframe.location.reload();

    and it works perfectly!


    Thank you for your help though!

    Best,
    Fab.
    Virtual Sheet Music®, Inc.
    http://www.virtualsheetmusic.com
    Musicians Page
    http://www.musicianspage.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •