Forum Moderators: phranque
just tried a bunch of codes to get the current window resized to completely FULL screen onload, but none worked, any suggestions please?
thanks in advance.
P.S. the only one which seemed to work was this one and it appears to be malicious:
<script type="text/javascript">
function max()
{
var obj = new ActiveXObject("Wscript.shell");
obj.SendKeys("{F11}");
}
</script>
</head>
<body onload="javascript:max()">
i tried the code i posted above, but my antivirus says it is harmful when i run the site with the browser, so i was afraid to open it and test. Any idea?
I know you said you didn't need opinions about whether you should do this or not, but I'm going to add my voice to those who recommend against it. If this is something that will be publicly available instead of just within your organization, you should leave the window size up to the visitor.
Actually, the script you pasted above, if you're really set on doing this, probably isn't the best way. F-11 uses true full-screen mode. I doubt that many average Internet users will know how to escape from full-screen once you force them into it. They will then be under the distinct impression that your site has broken their computer. I think there are javascripts out there that will automatically maximize a browser window, and this would be far better (though I still recommend against it).
"Best used at full screen "
message at the top and tell them to press F11 to do so.
Even then as Matthew has said, once again, people will be very wary of pressing one of the F keys. They may, at least the conscience viewers, think that you are trying to damage your PC and then they won't visit again; especially now with there being more awareness on viruses on the web.
I stand against this too.
However I would take some note to the given advice, if note total. Some users have no true experience with the PC.
If you do plan to use it, atleast take one of the precautions:
# Make it very clear what has happened
# Tell them how to get out of the situation
# Try to make sure the users have some experience with their browser.
# Cater your warnings for all browsers to your awarity.
That code is hard to find for a reason.
<script type="text/javascript">
function max()
{
var obj = new ActiveXObject("Wscript.shell");
obj.SendKeys("{F11}");
}
</script>
</head>
<body onload="javascript:max()">
but it has only one problem, search bar (in case you have installed one) navigation bar and window options (close, minimize, maximize) still appear and resting visibility to the window, that is what i want to avoid. I have warned users they have to press ALT and F4 to close the window, so there is no problem with that, any expert in this code around?
What about opening a new window with js that has no toolbars etc then maxing out the available space? bit of kludge to be sure and it will leave you windows start bar showing - just thinkin out loud..
The ActiveX method you orginally posted will only work for visitors using IE who have deliberately lowered their security settings (shudder...)
This is for a very good reason: enabling the wscript.shell object allows a remote web site to effectively take complete control of the visitors PC.
Your example only sends the keys to resize IE but it could do almost anything: delete files, mangle the registry, format the hard drive, send spam emails, download nasty programs to the visitors computer, etc.
Every other web site in the world manages just fine without this functionality. You don't need it either... ;)
Create 2 pages: index.htm and index2.htm
index.htm ->
<script language=javascript>
window.opener=self;
window.close();
window.open('index2.htm','','fullscreen=yes');
</script>
index2.htm --> Your page.
--------------------
index.htm opens index2.htm in fullscreen mode and then closes itself, without warning.
--------------------
I used it to open a total xp looking website.
Imre
<script language=javascript>window.opener=self;
window.close();
window.open('index2.htm','','fullscreen=yes');</script>
Shouldn't it be
<script language=javascript>
window.opener=self;
window.open('index2.htm','','fullscreen=yes');
window.close();
</script> Three questions?
:: ... Otherwise the window closes before it opens index2.htm?
:: When people load the page, if they have popup blockers, they may see it as a popup and block it and when they find their window has been closed and another one not opened, they'll get deterred away from your site!
:: Isn't closing and opening a window in a different location like redirecting, which, if it is, is much safer:
<script>
window.location="index2.htm";
</script> And with advanced redirecting in javascript I'm sure you could specify fullscreen too. You should use that code without window.close()
cmatcme
1. Calling localhost -> Opens fully, without statusbar and controls
2. calling my own server, on is opening with statusbar and controls
3. Uploaded to a lycos account -> Closses Both windows ):
Strange and not very funny.
Imre
<Sorry, no personal URLs.
See Terms of Service [webmasterworld.com]>
[edited by: tedster at 8:25 am (utc) on April 11, 2005]