• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to change the resolution of screen using JavaScript  RSS feed

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to change the resolution of window screen using JavaScript.
There should me a button , on clicking of that button the resolution should get changed.
Please suggest me how do I do that.
 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you plan to change the desktop resolution thats not possible since you would be giving the javascript undue access to the client's system.
If you plan to change the resolution of the window (browser) then you can use the following script:-

document.getElementById('container_id').style.width='[width passed as a parameter]';

The max width you can get by using the screen.availWidth property.
 
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As the previous poster said, you can not do it. Build your page to adapt to the user, not the other way around.

Eric
 
You have to be odd to be #1 - Seuss. An odd little ad:
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!