www.webdeveloper.com
Results 1 to 7 of 7

Thread: Controling popups and parent windows

  1. #1
    Join Date
    Jul 2003
    Posts
    8

    Question Controling popups and parent windows

    Greetings ya'all

    I have created a website where the visitor can click on a link, whereupon he gets a popup in which he can choose between two PDF documents to be displayed, Currently when he clicks on either link, the popup closes and displays the chosen document in the parent window. Which is actually fine, but I want the popup to close and open the chosen document in a new (fullscreen) window. The parent window from which the popup was opened should also stay open.
    Below the script I am currently using ...

    <a href="javascript:self.close();" onclick="goAndClose('../mydoc.pdf')">Document1</a>

    <script>
    <!--
    function goAndClose(page)
    {
    opener.location.href = page
    this.close;
    }

    //-->
    </script>
    If it's not broken, don't fix it ... optimize it!

  2. #2
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    <a href="../mydoc.pdf" onclick="window.open(this.href, 'child'); return false">Document1</a>
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  3. #3
    Join Date
    Jul 2003
    Posts
    8

    Smile

    Thanx Charles

    One thing though the popup window does not close. When I click on Document1, the new window opens as required, but the popup stays open.
    If it's not broken, don't fix it ... optimize it!

  4. #4
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    <a href="../mydoc.pdf" onclick="window.open(this.href, 'child'); if (self.opener && !self.opener.closed) self.opener.close(); return false">Document1</a>
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  5. #5
    Join Date
    Jul 2003
    Posts
    8
    Hi Charles
    I realy appreciate the help. JavaScript stays one of my constant headaches, I cannot seem to wrap my mind around it.
    Ok, with your script above the following happens. When I click on Document1 I get a message "This programm is trying to close this window" If I say "yes" the parent window closes, the popup stays open, and the document1 opens in a new window.
    I want to keep the parent window open, close the popup and open the Document1 in a new full window.

    Thanks again for the help, it is appreciated.
    If it's not broken, don't fix it ... optimize it!

  6. #6
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    I need you to more fully explain what you are trying to accomplish. At first I thought you had two window and now it looks loke you have three.
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  7. #7
    Join Date
    Jul 2003
    Posts
    8
    Hi Charles
    Thanx again for the help ...

    Yes there are 3 windows

    1-fullscreen
    2-popup
    3-fullscreen

    On window 1 I have a link "Documents", when the user clicks on it it opens window 2 (the popup) here the visitor can choose Document1 or Document2. If he clicks on either of them, the popup should close and open the selected document (pdf format) in a new window 3. Window 1 should stay open throughout all of this.
    I would have included direct links to the documents, unfortunately I have a bit of a space problem on the page and the client requested it this way. The client is king, right?
    Thanx again ...
    If it's not broken, don't fix it ... optimize it!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles