Results 1 to 7 of 7

Thread: How Do I Get Links To Open In the Same Popup Window?
      
   

  1. #1
    pfgroup is offline Private First Class
    Join Date
    Dec 2008
    Posts
    5

    Default How Do I Get Links To Open In the Same Popup Window?

    Hi Guys,

    By default, the popup window function within the link menu produces a new window for each link that is clicked, so if I click 10 different links on my site it opens 10 individual browser windows one directly on top of another -- not desirable. How can I get my links to open in the same popup window, or else, how can a new popup close and replace the previous one?

    Thanks!
    Shawn A.

  2. #2
    Join Date
    Mar 2006
    Location
    Mallorca, Spain
    Posts
    6,313

    Default Re: How Do I Get Links To Open In the Same Popup Window?

    If you have that many links, you might be better off using an Iframe and stay on the same page??

  3. #3
    D'son's Avatar
    D'son is offline Major General
    Join Date
    Apr 2008
    Location
    Illinois
    Posts
    2,580

    Default Re: How Do I Get Links To Open In the Same Popup Window?

    Why would you want yourpages to open in pop up windows? Are they not full pages but adds or forms? If they are full pages of content relating to your site, then have them all open in the same window (you will need full navagation on each page of course) leave the target area empty (nothing in it)

  4. #4
    pfgroup is offline Private First Class
    Join Date
    Dec 2008
    Posts
    5

    Default Re: How Do I Get Links To Open In the Same Popup Window?

    Hi Guys,

    Thanks for your quick replies. I'm not sure what an I frame is.

    Let me clarify my question -- I have an "About Us" page within my site that lists links to several of my clients' websites. When I click on each link one after another, I want each site to open within the same popup window, e.g., I don't want each click to open an additional popup window as it does now. Here's my web page, perhaps you can visit it to see what I'm talking about: http://www.caddesign.us/about%20us.html

    Thanks for your help,
    Shawn A.

  5. #5
    Karen Mac's Avatar
    Karen Mac is offline General
    Join Date
    Apr 2006
    Location
    X marks the spot
    Posts
    8,353

    Default Re: How Do I Get Links To Open In the Same Popup Window?

    Well Normallly....after a popup is generated.. people click it closed..otherwise they most likely WOULD open in the the same window.

    Now do you mean open and stay on your site? Then that would be an iframe. They either have to open in a pop up.. a new window or iframe

    Karen

    VodaHost

    Your Website People!
    1-302-283-3777 North America / International
    07031847328 / United Kingdom

    ------------------------

    Top 3 Best Sellers

    Web Hosting - Unlimited disk space & bandwidth.

    Reseller Hosting - Start your own web hosting business.

    Search Engine & Directory Submission - 300 directories + (Google,Yahoo,Bing)



  6. #6
    pfgroup is offline Private First Class
    Join Date
    Dec 2008
    Posts
    5

    Default Re: How Do I Get Links To Open In the Same Popup Window?

    Hi Karen,

    Thanks for your explanation -- sounds like I need the Iframe setup. I will pursue this and if I run into any problems I'll let you know.

    Appreciated!
    Shawn A.

  7. #7
    ANewBite is offline Private
    Join Date
    Apr 2009
    Posts
    1

    Default Re: How Do I Get Links To Open In the Same Popup Window?

    I took a quick gander at your site and source code, and I would say no to the iframe. An iframe is an html element that embeds another html document directly in your webpage. It doesn't seem to fit with what you're doing.

    Everything works as it should, except one part:

    Code:
    function popupwnd(url, toolbar, menubar, locationbar, resize, scrollbars, statusbar, left, top, width, height)
    {
       var popupwindow = this.open(url, '', 'toolbar=' + toolbar + ',menubar=' + menubar + ',location=' + locationbar + ',scrollbars=' + scrollbars + ',resizable=' + resize + ',status=' + statusbar + ',left=' + left + ',top=' + top + ',width=' + width + ',height=' + height);
    }
    here, your popupwindow variable is local, so you lose any reference to it when your function returns. Make it a global variable initialized to null, then either use window.open, if a popup hasn't been opened yet (i.e. the variable is still null) or change popupwindow.location if it has been opened. Here's an example that I'm using:

    Code:
    var newWindow = null;
    
    function view(url) {
    	if (newWindow == null || newWindow.closed) {
    		newWindow = window.open(url, '_blank');
    	} else {
    		newWindow.location = url;
    	}
    	newWindow.focus();
    	return false;
    }
    This code doesn't open the window in a popup, like yours; it simply opens a conventional window, which modern browsers usually put in a new tab. I would suggest for your usage that you actually do that instead, but a popup certainly isn't a sin. It's up to you.

    A couple notes about the code:
    -I used .closed to make sure that I didn't just change the location of a closed window. If you don't make this check, the window will still remain closed and your links won't appear to do anything if the user closes it when it first pops up.
    -All calls to this method should open the url in the same separate window, unless you refresh. Then a reference to the old window will be lost, and you won't be able to access it anymore. The code will simply use another new window to do the same thing.

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49