Results 1 to 4 of 4

Thread: Pop Up Window

  1. #1
    Join Date
    Jan 2007
    Posts
    94
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question Pop Up Window

    So, I have a pop up window that pops up user profiles on my site, my question is... Is there a way to have a link on the pop up window that closes the pop up window and passes the link to the main browser??

    Let me try to clarify, let's say if I'm on the site and I click on Suzie to check out her profile, a pop up window appears with her information. At the bottom of her profile she might have a link to her myspace page for example. Is there a way so when I click that link that the pop up window closes and it opens the myspace page in the main browser INSTEAD of opening the myspace page in the pop up window??


  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Place this in the head of the document that the pop up window displays:

    Code:
    <script type="text/javascript">
    
    function LoadandClose(url) {
      if (window.opener && !window.opener.closed) {
    
    window.opener.location.href= url;
         window.close();
      }
    }
    </script>
    Then place the this link where ever you want it at (edit the part in red):

    Code:
    <a href="http://www.domain.com" onclick="LoadandClose(this.href); return false;">Link Name Here</a>
    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  3. #3
    Join Date
    Jan 2007
    Posts
    94
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    It closes the window, which is excellent!! But, it goes to www.StupidPeoplepissmeoff.com/ (whatever their link is)... How can I have it just go to the link?

    Thanks!!

  4. #4
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Are you calling the link like this:

    or with the http:// in front of it. This script will not function properly unless you use the http:// part.

    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

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
  •