?
Solved

html (or other code) to detect screen resolution and change to 1024x768 from different resolutions

Posted on 2008-10-21
6
Medium Priority
?
2,124 Views
Last Modified: 2013-11-19
I have a friend in IT who is web mastering an intranet site where I work and he needs some coding help (with the appropriate language, Java, .asp, .html, whatever) to make sure the screen resolution on each computer of each user is 1024x768 whenever this site is accessed (We are using Windows XP Pro). Please feel free to ask for more info, if necessary.
0
Comment
Question by:gtgloner
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 11

Expert Comment

by:MacNuttin
ID: 22767270
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 22767296
Hello gtgloner,

I would say that this is a really bad idea! Anything that changes the screen resolution of my computer (or any other aspect of its configuration) would be instantly binned. I understand that this is an intranet and your users may well be strictly regulated, even so it is a bit much to change a user's resolution just to fit the design of your page. In fact it is completely the wrong way to approach it. If you cannot (for whatever reason) or will not design the site in such a way as it can adapt seamlessly to the resolution in use on the client then you can opt to design to a fixed size using CSS. Alternatively you can resize the browser window to a known and fixed size using window.sizeTo(1024,768). Even this is not necessarily user-friendly, it would be better to popup a new window with your fixed size.s

Regards,

TimCottee
0
 
LVL 7

Expert Comment

by:mltsy
ID: 22767784
What I would do is design your site with a fixed width, and then check the user's screen size (screen.width) and alert them if it is too small:
<head>
<style type="text/css">
  body {
    width:1000px;
  }
</style>
<script type="text/javascript">
  function body_onLoad() {
    if(screen.width < 1024) alert("This page is best viewed with your resolution set to 1024x768.  [Explanation, who to call for help, etc]");
  }
</script>
</head>
 
<body onLoad="body_onLoad()">
  ...
</body>

Open in new window

0
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
LVL 7

Expert Comment

by:mltsy
ID: 22767816
You could also check window.innerWidth to check the actual size of the browser window, and say "This site works best with your browser maximized at a resolution of 1024x768."
0
 
LVL 17

Author Comment

by:gtgloner
ID: 22769342
Here is my friend's response to the comments:

"So far the responses are about how to check the screen resolution.  What we need is a way through html or java to change the resolution on the fly."

So, what he wants to know is, can this be done?
0
 
LVL 43

Accepted Solution

by:
TimCottee earned 2000 total points
ID: 22769502
As I suggested back up there, using javascript you can set the browser window size:

<body onload="window.sizeTo(1024,768);">

For example. This will not affect the workstation itself but will ensure that the browser window is set to the required size. You can also add it to the resize event handler so that it will always remain the same size.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question