We help IT Professionals succeed at work.

How to make a page open full-screen in the same window

raives
raives asked
on
The function below opens a page in a separate window. The page doesn't fill the entire screen. How could the function be changed so that the page is opened in the currently open window (ie that a new window is not spawned) and that it would open full-screen regardless of the resolution used?

function open_page(){
      if (IE6){
      window.open("../englishIE6/entrance.html","","status=yes,toolbar=yes,location=yes,resizable=yes,scrollbars=yes");
   }
      else {
      window.open("entrance.html","","status=yes,toolbar=yes,location=yes,resizable=yes,scrollbars=yes");

   }
Comment
Watch Question

Commented:
just add fullscreen=yes in the window features

say,

windows.open("../englishIE6/entrance.html","","status=yes,toolbar=yes,location=yes,resizable=yes,scrollbars=yes, fullscreen=yes ");

do the same on the other statement.
 
HI,
You cannot open the current window to fullscreen.
Only option available is to open a new window to fullscreen.

window.open('../englishIE6/entrance.html,'','fullscreen=yes, scrollbars=yes')

This will open a new window to fullscreen regardless of the screen resolution.

Good Luck...:)
Commented:
If you still want to see the borders, titlebar etc you have to do this;

var width = screen.availWidth;
var height = screen.availHeight;
window.open("../englishIE6/entrance.html","","status=yes,toolbar=yes,location=yes,resizable=yes,scrollbars=yes,WIDTH=\"+width+\",HEIGHT=\"+height+\",TOP=0,LEFT=0\");

Commented:
Oops, sorry I copied the code from a cgi remove all the \ before the ".

Sorry.

-Richard

Author

Commented:
I did what rpimmer suggested, but the window still opens full-screen without titlebar, scrollbars, etc -- and I can't close it in any way!!! This is something I absolutely want to avoid the user from experiencing...

Vesa

Author

Commented:
Oops, I had also included "fullscreen=yes" in my code (how on earth *is* one supposed to close the fullscreen window?).

It would be nice to have the screen fill the screen *precisely* (as it does with "fullscreen=yes") *but* have all the other features (titlebar etc.) as well. Without "fullscreen=yes" the window never seems to precisely fit the screen (the way a browser window does when the title bar is double-clicked), although it almost does.

ravi_raj123: How could I simply open the linked page to the same window (which is normally fullscreen)?

Vesa

Author

Commented:
I noticed that

 var width = screen.availWidth;
 var height = screen.availHeight;

should be replaced with

 var width = window.availWidth;
 var height = window.availHeight;

for better results. Still, the match isn't perfect. But perhaps it never can be. So, the best solution might be to just open the link in the same window. Can't this be done?

Thanks again,
Vesa

Commented:
As you say there is no way to get an exact match unless you go for fullscreen=yes but you can get fairly close.  If you know that most will be windows for example you can always - 20 from the height and -10 from the width which will get you very close.

And in answer to your other question the only way to close the fullscreen window is to ctl alt del and kill it or to hit alt F4, not sure what to do on other platforms though.

-Richard

Commented:
Appologies, just saw in my own code the the height is -30 not -20.

Author

Commented:
"If you know that most will be windows"

Er, do you mean if I think most of the visitors will be "Windows users"?

Interestingly, my modification (WINDOW.availWidth, WINDOW.availableHeight) only works well up to
1152x864. At 1280 x 1024, the new window only covers something like 4/5 of the screen. At 1600x1200, the new window covers less than 2/3 of the screen.

Vesa

Explore More ContentExplore courses, solutions, and other research materials related to this topic.