javascript / php question
Okay, I dig the browser detection, but my question is....
I'm looking not only for brower detection, but also client screen resolution so... do I detect the screen resolution with javascript on the client side and then based on their resolution and the value held in $navigator_user_agent , push the user toward a specific web page on the server side...say, mypage.php/msie_1024 ? I'm gonna try and formulate some kind of code to show you, just so that I don't look like a total newbie mooch. of course, if the user has javascript turned off, this is all for naught...or is there a work-around? Am I making this more difficult than need be? Thanks in advance. the lazy_guy Back to top |
|||||
forget it. Instead of all the hassle, I've decided to scrap my design and
start over using a css liquid layout. I still may have to use some browser detection logic, but I'll cross that bridge when I get to it. Thanks. the lazy_guy Back to top |
|||||
Try using 90% display width
Hi Lazy Guy, welcome to the forums.
You pretty much already figured out the best way to do it, use css to set the widths, that's how these pages are done, they default to 90% display width, which looks ok in screens with dimensions of 800x600 to 1024x768, also larger are ok. However, be aware that doing CSS liquid layouts is tricky, it's fairly easy if everything is liquid, including margins/padding etc, but if you try having fixed width elements and percentage width elements next to each other it's pretty hard to get that to work right. Trying to maintain two sets of pages stops being fun very quickly, we've done that for older sites and it was a pain, that's definitely something to be avoided. However, you can very easily do javascript detection of the screen width then set your primary container display width dynamically, working off of a css declared default. That's how the main tech site works, check out its css and javascript and you'll get an idea, although that's a very complex solution since it detects the screen width then sets width to 100% if it's less than I think 800px, can't remember the exact number. Let me know if you have any questions on this, the main thing to remember is that you should never use javascript for site critical functionality, just use it for stuff that works as an extra feature or eye candy. If you have any questions feel free to ask, Jeff Back to top |
|||||
All times are GMT - 8 Hours
|