Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Maximising new window in javascript

  • 30-05-2007 04:05PM
    #1
    Registered Users, Registered Users 2 Posts: 91 ✭✭


    I need to open a new window in Javascript and when I do, I need to open this new window with the same resolution that the viewer is looking at.

    eg 1024x768 & 800x600

    also need to have location, status, toolbar, scrollbar and all enabled

    any ideas if there is a function for this??


Comments

  • Registered Users, Registered Users 2 Posts: 68,173 ✭✭✭✭seamus


    You use the window.open() function to open a new window, and then you can use the below code to "maximise" it.
    window.moveTo(0,0);
    window.resizeTo(screen.width,screen.height);
    
    The problem here is that it won't be "docked". If the window is already maximised, then it will actually undock it.

    Consider whether you need to do this. Doing this kind of thing is massively irritating for users. If a website ever attempts to resize the browser, I just close it and don't look back.


  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    seamus wrote:
    If a website ever attempts to resize the browser, I just close it and don't look back.

    Yeah, its generally frowned upon in web dev. Sites that do this aren't really trust worthy.


  • Closed Accounts Posts: 7,562 ✭✭✭leeroybrown


    seamus wrote:
    If a website ever attempts to resize the browser, I just close it and don't look back.
    Likewise. I have a large widescreen monitor and don't use the full width of the screen. I normally have something else open beside it. As far as I'm concerned my browser window dimensions are mine and I won't revisit your site if you mess with them.


Advertisement