Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    po-up window focus problem in explorer for PC

    Me again - and thanks for previous advice. Here's the latest (and last, I hope).

    I have a pop-up window which stays open and gets used for new images, called by links from the main page. I need it to come to the front of the main window when each time images load. It works fine on Safari, Explorer, Opera and Firefox for the Mac, but Explorer on the PC isn't working; it fails to even open the pop-up in the first place, let alone bring it to the front on a second visit.

    Any solutions?

    Heres the code I've used so far, found on a help-site:

    function windowOpener(url, name, args) {
    if (typeof(popupWin) != "object"){
    popupWin = window.open(url,name,args);
    } else {
    if (!popupWin.closed){
    popupWin.location.href = url;
    } else {
    popupWin = window.open(url, name,args);
    }
    }
    popupWin.focus();
    }

    with

    <a href="#" onClick=windowOpener("weblogo.html","images","toolbar=no,location=no,directories=no,status=no,menuba r=noscrollbars=yes,resizable=yes,width=600,height=400")>link to pop-up window</a>

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Code:
    var popupWin;
    function windowOpener(url, name, args) {
      if (!popupWin || popupWin.closed){
         popupWin = window.open(url, name, args);
      }
      popupWin.focus();
      return false; //cancel href action
    }
    ...
    <a href="weblogo.html" target="images" onclick="return windowOpener(this.href, this.target, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=600, height=400');">link to pop-up window</a>
    I made it so that the link will still open the page even if js is disabled.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  

    Posting Permissions

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