SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    May 2005
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to get the parent window url in child window

    Hello, I have facing a problem in refreshing a parent window from a child window. From child window I use

    opener.location.reload();

    to reload the parent window and it works fine. But the problem is whenever the parent window is refershing the follwoing message come

    ""The page cannot be refrshed without resending the information. click Retry to send the information again, or click cancel to reutrn to the page that you were trying to view."


    Can any tell me how to disable the message?

    I also use

    window.opener.location = "schedule.php?id=1";

    this also works fine. But the problem here is I need to open this child window from varius pages and for that I want make this "schedule.php" page dynamic. But I can't get the parent window url. Is there any option to get the parent window url in child window?

    Thanks in advance for helping me.

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    window.opener.location.href should contain the url that was called. You can only read this if its in the same domain as the window you are calling it from.

  3. #3
    SitePoint Addict jtrelfa's Avatar
    Join Date
    Oct 2004
    Location
    Troy, Mi
    Posts
    231
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I see what you're trying to do. The message you're getting is because the parent window is the result of a form that was POSTED.

    If you used GET, that should go away.

    If GET doesn't make it go away, then you may need to pass variables back and forth between the parent and child:

    Parent:
    Code:
    var thisURL = "http://example.com/schedule.php?id=1";
    Child:
    Code:
    opener.location.href = opener.thisURL;
    HTH,

    Jon

  4. #4
    SitePoint Enthusiast indigobean2003's Avatar
    Join Date
    Jun 2008
    Posts
    78
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jtrelfa View Post
    I see what you're trying to do. The message you're getting is because the parent window is the result of a form that was POSTED.

    If you used GET, that should go away.
    I was able to do this by replacing GET with POST, thanks for the suggestion.


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
  •