?
Solved

Use javaScript to make an existing window full screen?

Posted on 2004-10-31
8
Medium Priority
?
4,791 Views
Last Modified: 2011-02-10
I want to toggle a normal browser window between normal and full screen by cliking a button on the page within the window.  Is it possible to take a browser window that was opened normally and make it full screen?
0
Comment
Question by:soBC
8 Comments
 
LVL 21

Expert Comment

by:pinaldave
ID: 12457180
<html>
<body>
<script language="JavaScript">
<!--
window.open ("http://yahoo.com", "","fullscreen=yes")
-->
</script>
</body>
</html>
0
 
LVL 21

Expert Comment

by:pinaldave
ID: 12457184
0
 
LVL 7

Expert Comment

by:Ai3d
ID: 12457199
Paste this code to the HEAD of your html document.

<script>
<!--
function fullwin(){
window.open("http://www.yahoo.com","bfs","fullscreen,scrollbars")
}
//-->
</script>

<center>
<form>
<input type="button" onClick="fullwin()" value="Open Full Screen Window">
</form>
</center>


where http://www.yahoo.com is the address you need ot change it could be contact.html or http://www.yourdomain.com/contact.html (if the page you are re-directing to is already uploaded on the serveR)
Enjoy!,
Ai3d.

P.S:- Trying using Microsoft Frontpage if you could.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:soBC
ID: 12457330
Thanks for the responses, but the window I need to toggle is existing.  I dont want to open a new window in full screen mode...I want to take an existing window that is not in full screen mode and change it to full screen by clicking a button and invoking some JavaSciprt/dHTML/etc...
0
 
LVL 18

Assisted Solution

by:tusharashah
tusharashah earned 400 total points
ID: 12457348
On the OnClick event of your button add following JavaScript to make your window Full Screen:

function btnOnClick()
{
  window.moveTo(0,0);
  window.resizeTo(screen.width,screen.height);
}

-tushar
0
 
LVL 7

Expert Comment

by:Ai3d
ID: 12457353
sorry, i didn't get ya.
0
 
LVL 36

Accepted Solution

by:
Zyloch earned 400 total points
ID: 12457725
Like the others said, it's pretty impossible to make current window fullscreen.

You can use tusharashah's method, although the title bar, etc., unless you make the moveTo a negative amount and the browser width, height, a greater amount than the screen, for instance,

If the title bar is 50px (I'm not sure what it is, you'd use):
and the status bar is also 50px (again, not sure what it is):

window.moveTo(0,-50);
window.resizeTo(screen.width,screen.height+100);

The -50 hides the title bar and the positive 100 should theoretically hide the status bar and the title bar.

Another method would be to close the current window and open a new one. Again, this may not be most desirable, for instance, if there are POST variables, it could get a bit messy with hidden forms and such, but the general concept is follows:

function btnOnClick() {
   if (window.location.href.indexOf("fullscreen=yes")==-1) {
      window.open(window.location.href+"?fullscreen=yes","someWinTitle","fullscreen,scrollbars");
   } else {
      window.open(window.location.href.replace(/fullscreen=yes/g,""),"someWinTitle");
   }
   self.close();
}
0
 
LVL 3

Assisted Solution

by:PodExpert
PodExpert earned 400 total points
ID: 12458061
However, after installing Windows XP Service Pack 2, you will not be able to create a window greater than the screen, there are also some additional restrictions (applies only to Internet Explorer, of course). Using Zylochs method is therefor not recommended, because it will not work on updated systems with IE.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses
Course of the Month12 days, 23 hours left to enroll

578 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