Accurate browser detection/redirect possible using JavaScript? - redirect

Please forgive me if this answer is somewhere else on this site or online. If it is, I sure haven't found it in the past several days of searching.
What I am hoping to find is an "accurate" method of detecting a browser and redirecting to a simple, static page if not a recent browser.
The samples I have found until now often have not provided an accurate representation of the actual browser being used. For instance:
When testing with Navigator 9, I'll get a message that I'm using Firefox 2
When testing with Maxthon 3, it reports I'm using IE 9.
My site displays correctly in all the current browsers I've been testing it with. But I wish I could have a basic static page for those .01% who still are using an old browser for whatever reason. They could still get some basic information from my site, as well as encouraged to update to a more current browser.
If anyone has any useful suggestions, I'd greatly appreciate them.
Thanks so much.
Cheers,
David

Browser detection is never perfect, for a variery of reasons. If you are using jQuery, you should look into jQuery.browser.
I'd try to detect the browser on the server side and do an HTTP redirect if the browser is something non-standard. Most decent frameworks have functionality to detect the browser from the user agent string. Again, this is not perfect, mainly because of the data browsers report. Also, if Maxthon reports it's IE, that's because it is based on IE and therefore the layout engine should be the same.
So you either
support a small number of browsers and cater for their quirks, sending all other browsers to a basic page (this sucks for future versions of browsers because they might be standards-compliant but they will still display your very basic page), or
you have a standards-compliant page for all browsers and then you define alternatives for the ones that give you problems.
I'd go for the second option. It usually all boils down to one version for all browsers, and a number of hacks for various versions of IE. Also, remember to avoid padding in your CSS and use margins instead.
In the end, you probably shouldn't be testing for browsers and version numbers, but supported features. Try using Modernizr.

The $.browser property is deprecated in jQuery 1.3. On jQuery support site, they strongly recommend to use the detection feature (JQuery.support) instead of the jQuery.browser property.
Actually, this has been answered already in another question, please check here How can you detect the version of a browser?

Related

Is it possible to use iNotes with document mode 8 in an iFrame / Frame?

So here is my problem:
I have a website coded in xPages that loads iNotes (E-Mail Client) in an iFrame. Problem is that iNotes only works with document mode set to IE8 but I do not want to put the entire page into that document mode. So as it isn’t possible to set different document modes for iframes (at least I read that at microsoft and it didn’t work when I tried it) I thought about using frames where it seems to be (again: read it) possible.
So the question is, will it work? Before spending a lot of hours into a solution that does not, I wanted to ask here. Especially because someone might come up with an even better solution (which would be greatly appreciated!) ...

Silent Printing from Web Page

I am working on a web application that needs silent printing (without print dialog box) with client side printer.
After some research we found that we can make it work using ActiveX and Foxit Reader.
Currently it works great but it constraints us with IE only and we want to make it work with Firefox and Chrome as well.
I know there is no direct code to make it work, but there must a work around?
What I need is the point to start e.g. Chrome/Firefox plugins to access local printer - or make windows service that runs in background in the client side, change browser settings, use ActionScript etc.
It will also be great if someone also illustrate how Facebook access local webcam from its website it may make about accessing clients peripherals from website. Thanks in advance.
For anyone who still wants information regarding printing on Chrome and/or FireFox without the use of ActiveX, extensions or client-side scripting, please see my answer to another question similar to this.

Will iframed Facebook-Buttons quirk in IE6 by default?

I've integrated this nice Facebook-Button to my WordPress site via iframe. Although I care for cross-browser-compatibility plus the fact I could not influence the iframe content in regular ways I'm wondering why this quirks when viewed in IE6.
Could I've done something wrong anyway or is it conceivable stuff quirks by default and Facebook doesn't care about that?
Facebook does officially not support IE 6 any more.
(And I’m glad about that. Just wondering why you still care?)

What’s a good client-side fallback for HTML5 form field validation?

I've seen many different suggestions for fallbacks for browsers who don't fully implement html5 forms (solutions involving Modernizr, YepNope, Jquery validate...) but I haven't managed to get anything to work effectively.
Essentially apart from adding a datepicker which I've managed to get going with Modernizr and JQuery datepicker all I really need to do is get the validation to work in all browsers (main priority is the email validation)
Chrome and FF everything seems to work natively, yet surprisingly Safari validates without a proper email address. IE obviously doesn't support it either
Could anyone help with a reasonably straightforward fallback (probably via Modernizr)?
Thanks
Have you tried webshims lib? It's build on top of jQuery and I have implemented the forms chapter of HTML5 very accurately. You can find a list of supported attributes, properties and methods on the webforms site of webhims lib.
I would like to have some feedback on this.
cheers
Alex
Keeping in mind that proper validation should be done server-side, you can easily plug one of the many jQuery validation plugins.

Best way to rewrite modern browsers to modern version of app?

I have a Flash app at URL-A. I have a new non Flash version, that only works in modern browsers at URL-B. I can redirect all visitors from URL-A to URL-B with .htaccess or PHP but I wont know what browser they have in order to determine if I need to redirect or not.
So I am not sure what the best way to go about this is.
Basically if you are using IE8+, FF, Chrome, Safar, Opera I want you to go to URL-B. If you are using IE7- I want you to go to URL-A
Whats the best way to do this?
If you have no problem with using a small PHP library, look at the answer to this question and do a header("Location:url") redirect depending on which result you get.
If you'd rather use a .htaccess file, you could parse the USER_AGENT as shown in this question (it's aimed at mobile browsers but doesn't really matter). The PHP solution is much more convenient though.