JS to switch to full page view (F11 key)

S

SPG

Hi,

We have a web app that is IE dependant.

We now have a requirement to have a button on one of our menus to force the
page into full screen view as if the client pressed F11. (It'll do other
things like hide some of our frames and other screen data too, but that is
the easy part.)

We cannot re-load the screen using window.open(blah), it has to be done as
if they pressed F11.

I have googled this a bit and have only found psuedo solutions (Like just
resizing the screen to fit the resolutions etc).

Was wondering if anyone out there has managed to do this at all?

Steve
 
J

Jim Ley

We now have a requirement to have a button on one of our menus to force the
page into full screen view as if the client pressed F11. (It'll do other
things like hide some of our frames and other screen data too, but that is
the easy part.)

Was wondering if anyone out there has managed to do this at all?

Only by using Zeepe

http://www.meadroid.com/zeepe/

Jim.
 
S

SPG

Hmm..

Didn't want to use a 3rd party kit.. Banks don't like them!

Sort of did it in a demo by doing this:

<html>
<head>
<SCRIPT LANGUAGE=VBScript>
<!-- //
Dim bState

Function SwitchView()
bState = not bState
Set objInetExp = CreateObject("InternetExplorer.application")
objInetExp.TheaterMode=bState
End Function
// -->
</SCRIPT>

</head>
<body>
<input type="button" value="Switch" onclick="SwitchView()">
</body>

But it still seems to open a new blank page instead of effecting the
existing one. I think I will have a play with this obekct and see if I can
specify the window to effect.

Steve
 
J

Jim Ley

But it still seems to open a new blank page instead of effecting the
existing one. I think I will have a play with this obekct and see if I can
specify the window to effect.

The amount of script to do it to the existing window would be very
significant, you can't create a new object, you'll need to get a
reference to the existing one.

I've also never seen a bank which allows full unreserved script
priviliges to an intranet app, but don't accept the 3rd party app, in
fact there's a good chance they're using meadco stuff anyway, it being
used in print workflows the world over.

Jim.
 
G

Grant Wagner

SPG said:
Hmm..

Didn't want to use a 3rd party kit.. Banks don't like them!

Sort of did it in a demo by doing this:

<html>
<head>
<SCRIPT LANGUAGE=VBScript>
<!-- //
Dim bState

Function SwitchView()
bState = not bState
Set objInetExp = CreateObject("InternetExplorer.application")
objInetExp.TheaterMode=bState
End Function
// -->

Why are you using JavaScript comments in a VBScript?
</SCRIPT>

</head>
<body>
<input type="button" value="Switch" onclick="SwitchView()">
</body>

But it still seems to open a new blank page instead of effecting the
existing one. I think I will have a play with this obekct and see if I can
specify the window to effect.

There is already a key that does what you want (F11). Why not educate users to
use that already provided functionality, then trap when they do it:

<div style="position:absolute;width:100%;text-align:right;top:0px;">Hit F11 to
maximize</div>
<script type="text/javascript">
window.onresize = function() {
if (window.screenLeft < 0) {
alert('fullscreened');
} else {
alert('windowed');
}
}
</script>

Note when the window is fullscreened, you get two alert()s and when the window
is windowed, you get three. So you'll need to set a flag to only handle the
event (and remove menus or whatever else you want to do) once.

Alternatively (and probably better):

<div style="position:absolute;width:100%;text-align:right;top:0px;">Hit F11 to
maximize</div>
<script type="text/javascript">
document.onkeyup = function() {
if (event.keyCode == 122) {
if (window.screenLeft < 0) {
alert('fullscreened');
} else {
alert('windowed');
}
}
}
</script>

Also note the assumption that window.screenLeft is negative when the window is
fullscreened. This assumption needs to be tested. There may be a better way to
determine what state the window is in.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,792
Messages
2,569,639
Members
45,348
Latest member
RoscoeNevi

Latest Threads

Top