PDA

View Full Version : resolution detection with notification pop-up?



Chadi
07-01-2008, 01:50 AM
I have 15% of my visitors using 800x600 resolution, which makes my forum home look cramped and horrible. Can someone please explain how I can setup a script that automatically detects a visitor using this exact resolution (or perhaps any below 1024x768) and popup a window warning, or static warning on the actual page (maybe header?)...with a custom message suggesting they increase their resolution?

Even browser / version detection also would be great too, along with javascript being disabled.

I would appreciate some insight on this. Thanks.

jscheuer1
07-01-2008, 02:14 AM
Browser and resolution sniffing in a situation like this is rather pointless. Once you alert the user that they should use a higher res or another browser, what can the average user do about it?

Most people are already at their maximum resolution. And most people aren't going to install a browser just to view your site.

As long as the content is viewable and accessible at 800 x 600, there is nothing much to worry about. Folks who are limited to that resolution have become accustomed to things occasionally looking a bit cramped.

This is not to say that a site cannot be designed to work well in various resolutions.

You should be aware that lower resolution monitors make everything look bigger. If your font sizes are set as percents, the user can adjust their text size down, and if your layout is otherwise fluid enough, this will alleviate any cramped look to the page(s). In fact, the default text size for most users with 800 x 600 is smaller than that used by 1024 x 768 and above users.

Chadi
07-01-2008, 02:19 AM
And most people aren't going to install a browser just to view your site.

Quite the contrary. I have already posted a "Chad's Tip" thread in my forum which helped enormous amount of my non-technical members, even some technical that heeded my advice.

As for 800x600 being max resolution, I could be wrong here but that's almost unheard of this day and age unless your monitor is literally about 20 years old. I've been using computers since the 80's and I remember even the early 90's resolution max was pretty much about 1024x768.

Check it out:
http://www.talkjesus.com/technical-support/6710-online-protection-tips.html

jscheuer1
07-01-2008, 03:03 AM
I disagree with your assessment, but it isn't a big deal with me. Screen resolution is easy to detect, browsers are a bit trickier.

Virtually all browsers will correctly report these two properties:

screen.width

and:

screen.height

and report them quite literally, so if screen.width is less than or equal to 800:


if(screen.width<=800)
alert('Use a higher resolution');

or some such thing. Any resolution can be detected and acted upon in this sort of fashion.

When it comes to browsers, they can spoof as other browsers, but a clever script can cut through that (subject to future changes in browser's spoofing abilities, and future changes in the default self reporting of browsers). However, depending upon why you want to know, it is generally better to test if a method or object is available before using it, and then to branch your code accordingly. After all, who cares what the browser is, as long as it can handle the code?

But, if browser type/version sniff you must, this is a good resource:

http://www.howtocreate.co.uk/tutorials/jsexamples/sniffer.html

as is:

http://www.quirksmode.org/js/detect.html

Less useful in detecting, but perhaps interesting nonetheless is this page I created:

http://home.comcast.net/~jscheuer1/side/nav_obj/

which iterates the navigator object for virtually any browser. It doesn't detect anything, but it does report what any given browser has set as properties of the navigator object, and what those values are.

I do still stand by my premise though, which (to elaborate) is that you can design a page that will look good (not identically) in about any resolution, and that will function well (not identically) in about any browser with, or without javascript enabled. And that doing so is more professional looking, and perhaps even easier in the long run than trying to make your users change their hardware and/or software settings or equipment, or than is setting up several different versions of your site.

There is more to this issue. For example - the positive responses from folks you have educated. You are not going to hear much from people who found that effort obnoxious, they will just surf elsewhere. And - detecting things with javascript is limited, it excludes folks without javascript enabled. The list goes on and on.