Solved

Web Application browser window size

Posted on 2004-10-19
10
250 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 

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
 

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

813 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

12 Experts available now in Live!

Get 1:1 Help Now