Click here to Skip to main content
15,035,600 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
:omg: How can I avoid horizontal scroll in web pages through javascript; I mean the script will automatically adjust the screen resolution according as the resolution available on client machine?
Sunasara Imdadhusen 23-Feb-11 1:23am
Good question!

1 solution

I doubt that. You cannot adjust the screen resolution of client system - that would be a big security hole, which if allowed!

What you can do is, adjust your browser according to the screen resolution using Javascript.
You can always do something like this:
if ((screen.width < 1024) && (screen.height < 768))
    alert('Your screen resolution is less than 1024x768; this site is best viewed at 1024x768 resolution!!!')

Have a look at this blog entry[^] discussing the similar thing.

Also look at these threads:
Similar discussion as per question - 1[^]
Similar discussion as per question - 2[^]

If needed, there are quite a lot of discussion threads here.[^]
thatraja 23-Feb-11 16:22pm
Fine answer sandeep

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900