Forum Moderators: phranque

Message Too Old, No Replies

resize current window onload to full screen

is it posible?

         

supernuke

5:37 pm on Mar 13, 2005 (gmt 0)

10+ Year Member



hi

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()">

cmatcme

6:41 pm on Mar 13, 2005 (gmt 0)

10+ Year Member



Why you tried it and it didn't do any harm to your system or your page. Did it?

Longhaired Genius

8:31 pm on Mar 13, 2005 (gmt 0)

10+ Year Member



Just don't do it. It's wrong in principle. You have to let your visitors decide for themselves how they wish to view your pages.

supernuke

8:21 am on Mar 14, 2005 (gmt 0)

10+ Year Member



I dont need any opinion about if its correct or not to do this, i just need the code to resize window full screen, i require this for execute other scripts.

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?

MatthewHSE

5:14 pm on Mar 14, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's using ActiveX (which will only work in IE, incidentally) to simulate a "F-11" keypress. Chances are your anti-virus sees that as a threat. I wouldn't worry about it, but if your visitors have to deal with similar warnings, you will lose many of them.

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).

cmatcme

8:14 pm on Mar 14, 2005 (gmt 0)

10+ Year Member



A good alternative would be to put a

"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.

supernuke

2:11 am on Mar 15, 2005 (gmt 0)

10+ Year Member



thanks for your moral advices, but im not asking for them, i just need to know the code, thats all, i need it for some tests. I read somewhere that is imposible for a window to self resize to fullscreen, i dont know if this is true, but if it is, then the only way left is with activex, if its not harmful then i can use it, isnt?

cmatcme

7:59 pm on Mar 15, 2005 (gmt 0)

10+ Year Member



It's not harmful and the code you downloaded has the bonus of being used to simulate other keys.
Only some activex is harmful.

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.

oilman

8:29 pm on Mar 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<script Language="JavaScript">self.moveTo(0,0);self.resizeTo(screen.availWidth,screen.availHeight);</script>

have fun - no moral objections from this chair ;)

supernuke

2:15 am on Mar 16, 2005 (gmt 0)

10+ Year Member



thanks for the code, but actually i think with it window resizes not to full screen but to maximum available height and width, isnt? i think this code is the closest one to be accurrated i have tried it and it nearly worked,

<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?

oilman

5:30 pm on Mar 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



ah - you're correct supernuke - I didn't read the thread really closely - my bad. Sorry I can't offer any help on the ActiveX side - bit out of my end of the pool there :)

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..

cmatcme

5:51 pm on Mar 16, 2005 (gmt 0)

10+ Year Member



Where you told them about using ALT + F4 also tell them to right click and auto-hide.

cmatcme

5:51 pm on Mar 16, 2005 (gmt 0)

10+ Year Member



Where you told them about using ALT + F4 also tell them to right click on the tollbar and auto-hide.

supernuke

9:04 am on Mar 17, 2005 (gmt 0)

10+ Year Member



thanks, but the only thing i need to know is the exact code without making users do anything else but clicking a button to open the windw which resizes, activex sounds to be the only one solution, does anybody have anything else?

cmatcme

3:55 pm on Mar 17, 2005 (gmt 0)

10+ Year Member



Don't think it's possible.

mattur

4:40 pm on Mar 17, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



AFAIK there is no way to do this.

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... ;)

GirlGeek

6:34 pm on Mar 17, 2005 (gmt 0)

10+ Year Member



This would work if you launch the page from a pop up

<script>
>>
>>>>
>> function doPopUp(){
>> doPopUpWindow = window.open("http://www.Pagename.htm","fullscreen=yes
>> <http://www.Pagename.htm> ");
>> }
>>
>> </script>
>>
>>
>> //Launch with:
>>
>> <a href="javascript:doPopUp()">Click Here</a>
>>

GirlGeek

6:37 pm on Mar 17, 2005 (gmt 0)

10+ Year Member



That doesn't look quite right:

function doPopUp(){
doPopUpWindow = window.open("http://www.pagename.htm","Name","fullscreen=yes");
}

this is the code

supernuke

11:52 am on Mar 18, 2005 (gmt 0)

10+ Year Member



thanks, actually i know what is the code to open a window in fullscreen, but what i need is to resize the current one that opens from an external link, i cant explain why do i need it that way because its a long story, but that code i specified above is the only thing im looking for, i really hope it exists somewhere

imre

10:19 am on Apr 10, 2005 (gmt 0)

10+ Year Member



SOLUTION FOUND:

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

cmatcme

10:37 am on Apr 10, 2005 (gmt 0)

10+ Year Member



Some thoughts:

<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

imre

6:18 pm on Apr 10, 2005 (gmt 0)

10+ Year Member



Even worse.... The same piece of code, had three different results (!)

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]