• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2137
  • Last Modified:

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

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
gtgloner
Asked:
gtgloner
1 Solution
 
TimCotteeCommented:
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
 
mltsyCommented:
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
mltsyCommented:
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
 
gtglonerAuthor Commented:
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
 
TimCotteeCommented:
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now