checking parent's URL ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mel

    checking parent's URL ?

    how can i check parent's URL from a child (popup) window ? and how can i
    refresh it if the URL is say http://www.xxx.com/ ?

    thanks


  • jen_designs@hotmail.com

    #2
    Re: checking parent's URL ?

    <script language="javas cript">
    myURL = window.opener.l ocation.href
    if (myURL == "http://www.xxx.com/")
    {
    window.opener.l ocation.reload( )
    }
    </script>

    This only owrks if you opened the pop up using the window.open function.

    Comment

    • Randy Webb

      #3
      Re: checking parent's URL ?

      jen_designs@hot mail.com wrote:[color=blue]
      > <script language="javas cript">[/color]

      Language attribute is deprecated.

      <script type="text/javascript">
      [color=blue]
      > myURL = window.opener.l ocation.href[/color]

      if (window.opener)
      myURL = window.opener.l ocation.href;
      //the above line fails if window.opener
      //is from a different domain from the
      //current page.
      [color=blue]
      > if (myURL == "http://www.xxx.com/")
      > {
      > window.opener.l ocation.reload( )
      > }
      > </script>
      >
      > This only owrks if you opened the pop up using the window.open function.[/color]

      It only works if you opened the popup using window.open *and* the two
      pages are in the same domain.

      But, quoting what you are replying to *always* works and lets people
      know what you are replying to. Read all about it in the group FAQ.

      --
      Randy
      comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
      Answer:It destroys the order of the conversation
      Question: Why?
      Answer: Top-Posting.
      Question: Whats the most annoying thing on Usenet?

      Comment

      Working...