Solved

Web Application browser window size

Posted on 2004-10-19
10
248 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.

910 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