SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Sep 2011
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Call pop up window always on top

    Not real big with JS but am going through a bunch of books and tuts ect.

    For the moment I would like to know if there is a way to call up a pop up window from a button (have that done already) but have it stay on top of the main browser when you click back on the main browser. I'm using window.open=( ... to call the pop up window but have not found how to get the new window to stay on top when working back in original browser window that the pop-up was called from. Was able to set height, width, etc of the pop-up but not able to get it to stay on top. The one reference I saw was in an older book that stated it was only available in IE.

    Could someone help me out here?

    Would also like to know how to position the pop-up window when it is called.

    Did not see a way to do this but maybe just didn't know what I was looking at or put the pieces together.

    Thanks

    PS,
    Am I the only one who thinks the Rangers major league choked last night? Can't get one more strike, or just hold the opposition to only one run in an bat, twice each, to be world champs??? Are you kidding? I don't even care and I can't believe it. Move over Cubs.

  2. #2
    SitePoint Addict sdleihssirhc's Avatar
    Join Date
    Feb 2009
    Posts
    387
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I'm not sure about getting the pop-up to stay on top, but I'd be surprised if you could get it to work in anything other than IE. (That's not to say it's not worth still looking; that's a big portion of the market. And it would be just like IE to make some proprietary way to do that.)

    Positioning the pop-up is much easier:

    Code JavaScript:
    window.open('url.html', 'whatever', 'top=100,left=100');

    I don't actually watch baseball :/
    I'm the web overlord for Graphic Business Systems

  3. #3
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,810
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Since you have almost zero chance of it actually popping up in the first place (more likely it would open in a new tab if it opens at all) the fact that there is no way to keep it on top is not really going to affect things much.

    Perhaps you should look for a lightbox script instead as that allows you to do an in page popup that is always on top of the rest of the page.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  4. #4
    SitePoint Member
    Join Date
    Sep 2011
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi felgall,

    Now you have me worried as it seems to work fine. Click, and it opens every time. What is it, like rookies luck? and now I have to worry that it is going to fail at some point? From what I'm seeing, supposedly the second attribute in a window.open= is the target. On the other hand, as a rookie and looking at the number of posts you have... and consider that proper testing has not been done in some of the more off beat browsers, say IE6, 7, 8 or 9 and now I'm not so sure. lol

    Lightbox you say? will check into it.

    Is there any way to specify a location on a new window call?

    Thanks
    .

  5. #5
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,810
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by edziffel View Post
    Hi felgall,

    Now you have me worried as it seems to work fine. Click, and it opens every time.
    .
    Only in browsers that are configured to allow it. Many of your visitors will have their browser configured differently to yours.

    I have my browser set so that requests to open a new window either open in a new tab or simply replace the current page depending on how the call is being made.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


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
  •