Solved

Web Application browser window size

Posted on 2004-10-19
10
247 Views
Last Modified: 2010-04-23
Hi,

     This may be a dumb question, but I like to ask those.  Can I program my web application so that when it's run, the browser that opens is full screen?  I'm getting a small browser window and while debugging it's getting annoying to have to maximize it every time.

JP
0
Comment
Question by:gleznov
  • 5
  • 4
10 Comments
 
LVL 48

Expert Comment

by:AlexFM
ID: 12348386
If this is only debugging problem, there is a simple way. Run Internet Explorer, set it's window to normal (non-maximized) state and resize it so that it fills almost all screen. Close Internet Explorer. Now every new IE instance launched from Visual Studio is "almost" maximized.
0
 

Author Comment

by:gleznov
ID: 12349296
Anyway to hardcode maximization?  I may want this to be standard with anyone who uses the program later?

JP
0
 
LVL 10

Expert Comment

by:james-ct16
ID: 12368275
hi

If you dont mind doing it in javascript, so client side the following code is what i use to maximise the screen, has to be said i dont particuly like it as i consider it to be rude when someone else resizes my browser for me

regards

james

code follows
---------------------------------
//maximise the screen
function maxScreen()
{
  top.window.moveTo(0,0);
  if (document.all)
  {
    top.window.resizeTo(screen.availWidth,screen.availHeight);
  }
  else if (document.layers||document.getElementById)
  {
    if (top.window.outerHeight<screen.availHeight)
    {
      top.window.outerHeight = screen.availHeight;
    }
    if (top.window.outerWidth<screen.availWidth)
    {
      top.window.outerWidth = screen.availWidth;
    }
  }
}

// script to get screen height and width


function getXHeight()
{
  return top.window.outerHeight;
}

function getYHeight()
{
  return top.window.outerWidth;
}
0
 

Author Comment

by:gleznov
ID: 12368708
Hey James,

     I agree about the resizing rudeness, but this is only a company intranet program, and a standardized maximized-browser isn't so rude in this context.  Could you possibly tell me how to integrate that Java code into my VB.NET program?  The last time I used java was when I was designing webpages using DOS Edit and notepad...

JP
0
 
LVL 10

Accepted Solution

by:
james-ct16 earned 125 total points
ID: 12368946
hi
its fairly simple to integrate, paste the above code into the [filename].aspx page in the html header section in between
<script type="text/javascript">
<!--
//code here

-->
</script>

and then in the body tag add the following attribute onload="javascript:maxScreen()"

eg
<body bgcolor="#000000" onload="javascript:maxScreen()">


this change will of course have to be made on each page or to your header user control if you wrote one.

notes

As this uses the onload function it is not particulary mozilla/firefox friendly im currently looking to find a better was of doing this and shall let you know if i find one

james
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Author Comment

by:gleznov
ID: 12399319
Won't any changes I make to the .aspx code be changed every time I resave the file in visual basic .net?

JP
0
 
LVL 10

Expert Comment

by:james-ct16
ID: 12399448
hi
no, there are no changes needed evertime you save the page. you just add that to each page you to maximise. vs.net will not rewrite this code. if you want i can write out a complete page example, but i have posted everything that you need to do it.

regards james
0
 

Author Comment

by:gleznov
ID: 12399634
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="DBItem.aspx.vb" Inherits="OEL2.DBItem"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
      <HEAD>
            <title>DBItem</title>
            <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
            <meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
            <meta content="JavaScript" name="vs_defaultClientScript">
            <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
      
            <script type="text/javascript">
            <!--
            //maximise the screen
            function maxScreen()
            {
              top.window.moveTo(0,0);
              if (document.all)
              {
                top.window.resizeTo(screen.availWidth,screen.availHeight);
              }
              else if (document.layers||document.getElementById)
              {
                if (top.window.outerHeight<screen.availHeight)
                {
                  top.window.outerHeight = screen.availHeight;
                }
                if (top.window.outerWidth<screen.availWidth)
                {
                  top.window.outerWidth = screen.availWidth;
                }
              }
            }
            // script to get screen height and width
            function getXHeight()
            {
              return top.window.outerHeight;
            }
            function getYHeight()
            {
              return top.window.outerWidth;
            }
            -->
            </script>

      </HEAD>
      <body MS_POSITIONING="GridLayout" onload="javascript:maxScreen()">
            <form id="Form1" method="post" runat="server">
                  <asp:label id="Label1" style="Z-IND.....

I have a question - I should have checked before I accepted in case you never see this - but this is what I did by clicking my form and choosing View HTML - it still doesn't work?

JP
0
 
LVL 10

Expert Comment

by:james-ct16
ID: 12400180
hi

i have just tested the following code in both ie and firefox (latest build) and it works in both. this is undoubtidly (sorry about spelling) a silly question but you do have javascript turned on, i presume you do. in that case do you have any non standard popup killers that may be stopping the onload event?


regards

james

<html>
     <head>
          <title>DBItem</title>
          <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
          <meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
          <meta content="JavaScript" name="vs_defaultClientScript">
          <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
     
          <script type="text/javascript">
          <!--
          //maximise the screen
          function maxScreen()
          {
            top.window.moveTo(0,0);
            if (document.all)
            {
              top.window.resizeTo(screen.availWidth,screen.availHeight);
            }
            else if (document.layers||document.getElementById)
            {
              if (top.window.outerHeight<screen.availHeight)
              {
                top.window.outerHeight = screen.availHeight;
              }
              if (top.window.outerWidth<screen.availWidth)
              {
                top.window.outerWidth = screen.availWidth;
              }
            }
          }
          // script to get screen height and width
          function getXHeight()
          {
            return top.window.outerHeight;
          }
          function getYHeight()
          {
            return top.window.outerWidth;
          }
          -->
          </script>

     </HEAD>
     <body MS_POSITIONING="GridLayout" onload="javascript:maxScreen()">
     <p>my body</p>
     </body>
     </html>
0
 

Author Comment

by:gleznov
ID: 12400244
JAVA's enabled according to options (security as well as advanced tabs in IE/options).  However, I'm reading a microsoft book and just also tried to do a new page (in the HTML button code, add onclick="window.open('web.page')" and that's not working either.  Wonder what I've got wrong in here

JP
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now