August 10, 201115 yr im using the browser.php file to detect a browser and then echo out a corresponding stylesheet http://chrisschuld.com/projects/browser-php-detecting-a-users-browser-from-php/ it all working nicely, but i realised that only browsers which i specify with an if statement can receive a style sheet, so if someone is using a browser which i havent done an if statement for goes to the website, they will have no css. Now obviously a solution is to create an if statment for every browser, but that would just be silly as there are so many. So is there a way i can do an else statment or if not equal to? i have actually tried adding a final else statment to the bottom of the php, echoing out a small piece of text...but this showed on every browser so clearly didnt work. I also tried an if not statment, which worked, but then was used instead of the other if statments, e.g. if not mozilla would then use that stylesheet on everything else. thanks in advance
August 10, 201115 yr Browser sniffing is a bad idea, because there's no way you can possibly test for every version of every browser, and you'd have to keep updating it. Not remotely feasible. It's much better to design a responsive layout using Mobile First methodology, adapting it to larger screens with media queries. If you start from a CSS reset and write valid markup there's no reason why browsers should display anything wildly inconsistent. Edited August 10, 201115 yr by Renaissance-Design
Create an account or sign in to comment