Forum Moderators: open

Message Too Old, No Replies

Using Javascript in IE6 to change screen resolution

is it possible?

         

ga_ga

6:21 am on Feb 21, 2004 (gmt 0)

10+ Year Member



Writing a set of games pages - they're all the same game, except that the java applet is sized differently to suit different screen resolutions. I was thinking about providing a button for users (those who aren't particularily tech-savvy) so they could easily switch between resolutions. Can it be done in js, if so, what's cross browser support like?

Thanks

isitreal

6:10 pm on Feb 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Yes, it's very easy to set the window width, all you have to do is have a function that sets the main container width at x pixels, document.getElementById(container_id).style.width = [passed width parameter].

I assume that's what you're asking, obviously you can't change the actual desktop screen resolution with javascript, that would be giving javascript unacceptable access to the client machine.

All the contents would have to be sized relatively to that absolute container, that is, at 100% or whatever width.

Keep in mind that a window in a 800 px wide resolution screen only has about 760px of actual useable space because of the right hand scroll bar of the browser.

ga_ga

12:06 am on Feb 22, 2004 (gmt 0)

10+ Year Member



Thanks isitreal.

> obviously you can't change the actual desktop screen resolution with javascript, that would be giving javascript unacceptable access to the client machine.

- that *was* in fact what I was seeking, not to force change on the client but simply to try & make it easy to change for some users. bit rusty on js here, yes I can see now it'd be a capability too far. I'll go with an informational FAQ link instead :-)

isitreal

1:52 am on Feb 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You can detect the screenwidth easily, and pop up an alert or something that tells them how to set their screen width:

screen.availWidth is what you're looking for in that case