Web Application browser window size

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
gleznovAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
james-ct16Connect With a Mentor Commented:
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
 
AlexFMCommented:
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
 
gleznovAuthor Commented:
Anyway to hardcode maximization?  I may want this to be standard with anyone who uses the program later?

JP
0
Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

 
james-ct16Commented:
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
 
gleznovAuthor Commented:
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
 
gleznovAuthor Commented:
Won't any changes I make to the .aspx code be changed every time I resave the file in visual basic .net?

JP
0
 
james-ct16Commented:
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
 
gleznovAuthor Commented:
<%@ 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
 
james-ct16Commented:
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
 
gleznovAuthor Commented:
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
All Courses

From novice to tech pro — start learning today.