Hot answers tagged browser-detecting
7
Basically it started because some websites used to sniff the user-agent to tell what browser someone was using so they could block browsers that they thought wouldn't work with their websites. Specifically, websites were blocking Internet Explorer because it didn't offer as many features as Netscape Navigator. Instead of simply building a website that works ...
6
Note: Not a direct answer, but IMO a valuable contribution. Of course this answer is dependent on your requirements, but I think many readers developing for consumers will find it useful and relevant, especially in the future.
To such a fine degree, I don't.
Of course, user-agent detection is great to serve an optimized mobile version for devices with ...
3
I do not really know how they do it exactly, but I know a method of how it can be done. HTML5 has this option build in. It is done by local storage.
Check out this link: http://diveintohtml5.org/storage.html
But maybe there are other methods, maybe by javascript which could be compatible with more browsers.
3
OMG, are you really keeping your own database up to date? I'm so sorry about you...
First tip: If you only need a very simple and minimal solution to detect brand and model, go with WURFL if you want it for free or DeviceAtlas if you can afford it. The second one works probably better (just my personal opinion).
Also, take a look at this comparision ...
3
You can use conditional comments to fix issues with Internet Explorer. Aside from that, you shouldn't ever need to target Firefox/Chrome/Opera separately from each other, they all support the standards.
Caching shouldn't enter into it; you should be serving the same code for all browsers.
2
The best, easiest way is to use a library. Libraries like OOCSS, Blueprint, or 960gs are already engineered to replicate their display across the major browsers. All you're left with after that, most of the time, is your making sure your custom styles are cross-browser compliant and that your markup doesn't produce any problems.
Avoid hacks like the plague ...
1
Detecting based off User Agent is, and always will be, an inexact science. I think a much better option would be to detect the width of their device, and then decide which one to send them to. Something like
<script>
if ($(window).width < 600) {
window.location.href="yoursite.com/mobile-version.html";
}
<script>
Could do what you ...
1
I don't exactly understand what you need, but if you just want the numbers, then you can get them at Google Analytics -
In the menu on the left, in the Audience --> Technology --> Browser & OS. Then select OS as the secondary dimension.
But if you want real time data, or need to send data to the expensive service, then a regular expression on the ...
1
The site http://detectmobilebrowsers.com/ suggests using two regular expressions and some substrings. They make the code available in some sixteen programming languages. Here is what they recommend in JavaScript.
...
1
It works for me, I changed ^Mozilla/4(.)MSIE to !^Mozilla/4(.)MSIE to test it with any other browser. Normally a HTTP 500 error when modifing your htaccess means that something is incorrect with the htaccess file. Copied from apache manual at http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
RewriteCond %{HTTP_USER_AGENT} ^Mozilla/4.*
RewriteRule ...
1
Please try to use the RewriteLog directive: it helps you to track down such problems:
# Trace:
# (!) file gets big quickly, remove in prod environments:
RewriteLog "/web/logs/mywebsite.rewrite.log"
RewriteLogLevel 9
RewriteEngine On
Then tell me as a comment what it gives and I'll update my answer to help you.
1
I know that most forms that 'save drafts' in case the browser crashes or the user leaves the site use ajax to store data on the server. If you write something on blogger, or write an email in gmail the form autosaves what you write every minute. Now if anything happens to your browser or connection you have a draft saved that you can continue editing before ...
1
When I read questions and answers like this I start to think I might be crazy, but I have written fairly complex websites using quite a bit of css, including css3 and other trickiness, and I have never had to resort even to conditional comments.
I do however constantly check my work accross multiple browsers (I code predominantly in Chrome, and test in ...
Only top voted, non community-wiki answers of a minimum length are eligible

