Results 1 to 4 of 4

Thread: Center Popup Window without Javascript?

  1. #1
    Join Date
    Jan 2006
    Posts
    234
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Question Center Popup Window without Javascript?

    Hi.

    I got this program FormArtist which provides a link to open the form in a popup window.
    Bu the window is not a 100% centered on the screen.
    Is it possible to center this popup window without javascript?
    Here wghat the link looks like:
    <a href="#" onclick="window.open('http://www.arbitrade.org/Form/arbitrade.htm', 'arbitrade', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=690,height=530');">Contact Form</a>
    I think it is possible as someone showed me before how to open a window centered without javascript but I don't have that piese of code anymore.
    Maybe someone here can show me what to change in this code here to center the popup.

    Thanks inadvance.

    Cheng

  2. #2
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Cheng
    I got this program FormArtist which provides a link to open the form in a popup window.
    You shouldn't use a pop-up window, especially for a contact form (as this would appear to be). Pop-ups are unreliable, have been for a while, and are becoming less and less viable. How do you expect someone to contact you if the pop-up is blocked, or, with the code you posted, with scripting disabled?

    Bu the window is not a 100% centered on the screen.
    Putting it there reliably isn't very feasible; most solutions you'll find on the Web don't consider multiple monitors.

    Is it possible to center this popup window without javascript?
    No, not at all.

    <a href="#" onclick="window.open('http://www.arbitrade.org/Form/arbitrade.htm', 'arbitrade', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=690,height=530');">Contact Form</a>
    At least rewrite that to:

    Code:
    <a href="http://www.arbitrade.org/Form/arbitrade.htm" target="arbitrade"
        onclick="return !window.open(this.href, this.target, 'scrollbars,resizable,width=690,height=530');"
      >Contact Form</a>
    A pop-up should always have scrollbars enabled and be resizable. If you gave it the right size, neither will matter. However, if you didn't, the content will be clipped and inaccessible.

    Maybe someone here can show me what to change in this code here to center the popup.
    If you must use pop-ups, let the window manager handle positioning.

    Mike

  3. #3
    Join Date
    Jan 2006
    Posts
    234
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    Hi Mike.

    Thanks for the advise.
    What do you meam by:
    If you must use pop-ups, let the window manager handle positioning.
    Thanks again.

    Cheng

  4. #4
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Cheng
    What do you meam by:
    If you must use pop-ups, let the window manager handle positioning.
    The window manager controls window positioning, amongst other things. It will know the preferred monitor in multi-monitor systems, where the last window created was positioned, how to cascade windows, and so on. Leave it to make the decision.

    Mike

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
  •