What happens to all the Opera, Chrome, and Safari browsers that claim to be IE or Firefox when you perform that text and what about all the IE and Firefox browsers that claim to be ‘Eat at Joe’s Finest Food Restaurant’?
If the browser claims to be IE or Firefox then it could be any browser at all since they can all identify themselves as one of those two and IE and FireFox can identify themselves as anything at all as they allow the browser owner to enter anything in the useragent.
Thank you all for the help.
This was just a hypothetical question.
I know it would be absolutely ridiculous to use such a script on an actual site, but I was just wondering if it could be done and if so how.
Also withbthe script I assisted in developing to detect a browser and attach a stylesheet. I wasnt just exercising my skills.
The only reason I can think of for someone to change the default value of their browser’s useragent is to attempt to fool a web page into rendering the page content into a browser correctly that would normally not be supported. In that case if the page doesn’t render correctly in the user’s browser then the web page author loses nothing because the user’s browser wasn’t being supported by the page author in the first place.
I sometimes find that. I’m browsing with Google Chrome and the web page says that I must use Firefox or Internet Explorer to view their page.
I don’t even bother to change my useragent. If they’re going to pull lazy stunts like that, I just go to a different web site instead. There’s plenty of other web pages to go to.
I don’t know if it’s a lazy stunt. The page author is probably just targeting specific browsers in the knowledge that IE and Firefox cover at least 80% of users on average. Maybe the author is happy to forgo users who aren’t using the preferred browser? But in any case, since it’s impractical to support every single browser and version, I would think the author sets a default css for non supported browsers which means the page could still render correctly in at least some of those unsupported browsers.
The issue is not about supporting non-supported browsers - the problem is about locking everything else out.
You don’t have to actively support every flavour of web browser that’s out there. That’s why standards are called standards.
Start with the standards, apply special fixes if needed for Internet Explorer and any other specific web browsers that you actively support, and let the rest interpret the page as they will.
ok I think we’re talking about two different scenarios. I agree if the author needs everyone to be able to have the web page rendered correctly. I’m talking about the situation where a page author might want to target a specific audience for whatever reason in which case they can set a css for their target browsers and another css for every other browser and so no-one is technically locked out.
Such things are called intranets and extranets - depending on whether the site is accessible only from within a specific network or is available from more than one network (such as a company network and their client’s networks as well).
Such targetting has NO place on the internet where people are free to use ANY browser they like and if the browser they choose follows the standards should expect to be able to get any web page to work. Any that do not work are junk and they will of course tell all their friends about that junk so that their friends can tell their friends etc so that no one will waste time on the junk. Placing junk pages on the internet is basically saying “Go away and tell everyone else to stay away too because all I can create is garbage”.
So yes you are talking about two different scenarios - one on the internet and one not.
You’re not suggesting that I or anyone else can’t just target IE and Firefox browsers if we wish to, are you? Just like users can choose whatever browsers they want to use I can choose what browsers I want to support because there are too many diffrent browsers and versions to guarantee 100% that pages will render correctly in all of them. I don’t see anything wrong with making sure the web page renders correctly in IE and FF, which will cover the vast majority of users on average, and then using the FF css (if it is different to the IE) as the default css for non IE/FF browsers.
yes but I never suggested anyone should stop people from visiting their website. All I was saying is that I and everyone else have the right to choose which browsers to support and then provide a default css for users with browsers not on the web developer’s support list. I don’t have the resources to guarantee 100% that a web page will render correctly in all browsers and versions.