PDA

View Full Version : Need to detect the browser and resolution and...



purifier
12-14-2006, 07:45 AM
I wanted to do something like the following:

START
browser = detectbrowser();
resolution = detectresolution();

if(resolution != 1024x768)
printf("This site was designed for a 1028x768 resolution. Your screen resolution is different from the one that is required to view this site properly. You may experience problems unless you change your screen resolution"); //Should be displayed at the top of the page in RED

if(browser == IE)
printf("This site can be ideally accessed from Firefox and Opera."); //Again this has to be in RED on the top of the page.
END

I want to be able to put this in a detect.js and include this in my page. Can someone please help me code this?

jscheuer1
12-14-2006, 08:30 AM
You really are much better off designing your pages so that this is not needed.

purifier
12-14-2006, 08:38 AM
Sorry Sir... but i didn't get you :(

BLiZZaRD
12-14-2006, 09:37 AM
John is saying that doing this will cause a lot more problems than it will solve. Both for you and your visitors.

He is saying that with minimal effort you can design your web pages so that this is not needed.

That is unless you have a very specific need to do so, in which case you should post what that reason is, and at least a link to that page or paste the code here.

More than likely there is a better alternative.

purifier
12-14-2006, 10:25 AM
Oh. got it! Its not that I have a reason but it is only that I can't do it. I'm using Joomla with a template that is fixed and that which is designed for a 1028x768 resolution. And I didn't find a fluid template that fits my need except this one. Is there anyway I could make this template a fluid one? I presume the answer would be "not that easily" That was the reason... There's another reason which I'd say after I get an answer for my question of ease ;)

jscheuer1
12-14-2006, 05:20 PM
Will Joomla allow you to use other templates? I'm thinking of ones written in just plain HTML. if it doesn't, someone should get on it and write some fluid compliant templates for Joomla, there may even be some out there if you search hard enough for them.

purifier
12-14-2006, 05:43 PM
Yeah Joomla does allow Fluid Templates... but what I was trying to say is that there are so fluid templates that are suitable for my site.. :( thats the problem...

jscheuer1
12-14-2006, 06:07 PM
Yeah Joomla does allow Fluid Templates... but what I was trying to say is that there are so fluid templates that are suitable for my site.. :( thats the problem...

This is such a major usability and maintenance issue that I strongly recommend that you find one that will work or that you adapt an existing one to make it serviceable to your needs.

What happens is that, with browser detection, many browsers fail the test that should pass it and many pass that should fail. With new browsers added and old browsers updated frequently, this becomes even more of a nightmare.

Resolution is irrelevant, a page should be able to be viewed in all common resolutions - that is not so hard to design for and doesn't require a fluid design. If nothing else, a centered or left aligned 776px wide block format will work.