How do I get my page to maximize when it opens?


I'm using Visual Studio ASP.NET 2005.  How do I get my page to maximize when it opens?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Do you mean how do you get the browser to maxmize when someone visits your site?
Hi There,

If you are talking about a window then you could use something like this.

in the body using onload you can call a function:

<BODY  onload="MaxWindow ();" >

then in the head of the document you can place the javascript function itself:

<SCRIPT language="JavaScript">
      function MaxWindow ()

This will allow the window to maximise when opening. Hope this helps


DeniseGoodheartAuthor Commented:

I would like to use VB.NET in the ASP.NET Page_Load event to have the page appear as maximize.

Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

You want the window to maximise when loaded, is that correct?
The page can't be maximised using VB.Net because VB.Net executes on the server side. The maximisation has to occur on the client side, so javascript is your best answer.

use the RegisterStartupScript method to place the code inside the Page_Load event.


Write a javascript function and run that funciton on load.

Your aspx page

function maximizeWindow() {

      <body leftMargin="0" topMargin="0" onload="maximizeWindow();" marginwidth="0" marginheight="0">

Code is similar to what bullrout is given above, i just added window.moveTo(0,0);
Rest are all same except screen.availWidth,screen.availHeight.
Credit goes to bullrout

Add this in your page_load, (modified based on bullrout's comments)
        Dim cscript = ""
        cscript = "<script language=JavaScript>window.moveTo(0,0);window.resizeTo(screen.availWidth,screen.availHeight);</script>"
        ClientScript.RegisterClientScriptBlock(Me.GetType(), "cscript", cscript)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DeniseGoodheartAuthor Commented:
Hi All,

I learned a lot  with all your great help.

Many Thanks,
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.