popup blocker

Discussion in 'Javascript' started by jimmygoogle, Oct 16, 2007.

  1. jimmygoogle

    jimmygoogle Guest

    I am trying to get a site with a form on it to open a new window
    (once) when any element of the form has focus.

    The function I am using on page load causes the popup blocker to be
    triggered. However, if I set the onfocus in the form element (onfocus
    = loadWindow();) - everything works as it should (no popup blocker).
    Anyone know how to do this without going through each form element and
    putting the onfocus code in there?

    function setHandlers() {

    var inputs = document.getElementsByTagName("input");

    for (var i = 0 ; i < inputs.length ; i++){

    //blocked by popup blocker
    inputs.onfocus = function(){loadWindow();}

    //causes the page to try to load the window
    for each form element
    //inputs.onfocus = loadWindow();

    }

    }
     
    jimmygoogle, Oct 16, 2007
    #1
    1. Advertising

  2. jimmygoogle

    jimmygoogle Guest

    On Oct 16, 8:46 pm, Randy Webb <> wrote:
    > jimmygoogle said the following on 10/16/2007 5:23 PM:
    >
    > > I am trying to get a site with a form on it to open a new window
    > > (once) when any element of the form has focus.

    >
    > Bad idea.
    >
    > > The function I am using on page load causes the popup blocker to be
    > > triggered.

    >
    > Hmmm. User sets focus, window opens, user closes unwanted popup, input
    > field regains focus, window opens, repeat annoyance factor.
    >
    > Bad idea again. And, that is assuming the window even opens to start with.
    >
    > Rethink your design, it is fatally flawed and doomed as it is.


    The window is opened underneath the current window only once thats
    it. It cannot be opened more than one time. Granted it is annoying
    it is what my project calls for.
    >
    > --
    > Randy
    > Chance Favors The Prepared Mind
    > comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
    > Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/
     
    jimmygoogle, Oct 17, 2007
    #2
    1. Advertising

  3. jimmygoogle wrote:
    > The window is opened underneath the current window only once thats
    > it.


    Firefox has a default preference to prevent this.

    > It cannot be opened more than one time.


    Iff it can be opened.

    > Granted it is annoying


    And leaking memory, at least on Windows.

    > it is what my project calls for.


    It isn't.


    PointedEars
     
    Thomas 'PointedEars' Lahn, Oct 17, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Simon Segal

    XP SP2 Popup Blocker & Frames

    Simon Segal, Nov 8, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    396
    Simon Segal
    Nov 8, 2004
  2. Jachu

    new windows popup blocker

    Jachu, May 13, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    902
    Jachu
    May 13, 2005
  3. AssanKhan Ismail

    Google-Yahoo Popup Blocker is not working

    AssanKhan Ismail, Aug 2, 2006, in forum: ASP .Net Security
    Replies:
    0
    Views:
    152
    AssanKhan Ismail
    Aug 2, 2006
  4. dave yan

    help in detecting aol popup blocker

    dave yan, Sep 24, 2003, in forum: Javascript
    Replies:
    10
    Views:
    198
    dave yan
    Oct 15, 2003
  5. Ashish
    Replies:
    2
    Views:
    207
    Richard Cornford
    Oct 31, 2004
Loading...

Share This Page