tags:

views:

438

answers:

2

What is best way to open a pop up window maximized to the user's screen configuration? I am using C# ASP.NET 3.5 web site project.

Update:

@Anthony - The windows xp task bar covers up some of the browser window. How do I set to maxmmumize and stop at the windows xp task bar?

Update 1:

I used the following the solution to maxumize the pop up window, but it opens the window first then moves it to the upper left corner of the screen. Is there a way just to open the pop up at the 0,0 position?

function openMaxWindow(url) {
    var name = "MyWindow";
    var features = "status=1,toolbar=1,location=1,menubar=1,scrollbars=1,resizable=1,top=0,left=0,height=" + screen.availHeight + ",width=" + screen.availWidth;

    var newWindow = window.open(url, name, features); 
}

Update 2:

Figured it out, I needed to add top=0 and left=0 to the features list.

+4  A: 

Use javascript to run

var newWindow = window.open(); newWindow.resizeTo(screen.width, screen.height);

Obviously, you need to use the appropriate parameters to the window.open() statement.

This link also shows how to do it

Edit

newWindow.moveTo(0,0);
newWindow.resizeTo(screen.availWidth, screen.availHeight);
Anthony
I updated my questions based on your answer.
Michael Kniskern
Awesome....that worked!
Michael Kniskern
I updated the question with feedback from customer.
Michael Kniskern
I don't know your specific requirements, but keep in mind moveTo() and resizeTo() won't work in some browsers. For example, in Firefox if you go to Tools > Options... > Content > JavaScript > Advanced... and uncheck Move or resize existing windows the code presented will fail. Even with that option enabled, the code presented will (in a default Firefox configuration) open a new tab, then resize the existing browser to fill the available screen space, something your users may find annoying.
Grant Wagner
@Grant - This is an intranet application and our default compamny browser is IE7.
Michael Kniskern
A: 

function maximizeWindow() { window.moveTo(0, 0); if (document.all) { top.window.resizeTo(screen.availWidth,screen.availHeight); } else if (document.layers||document.getElementById) { if (top.window.innerHeight < screen.availHeight || top.window.innerWidth < screen.availWidth) { top.window.outerHeight = screen.availHeight; top.window.outerWidth = screen.availWidth; } } }

Anter