This is a migrated thread and some comments may be shown as answers.

Device specific content targeting, need suggestions since $.Browser Deprecated

1 Answer 15 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Christopher
Top achievements
Rank 1
Christopher asked on 05 Sep 2013, 05:41 PM
Since $.Browser is deprecated and $.Support doesn't appear to provide a check for supported content types, what's the best way to deliver device specific content types?

Here are some valid examples;
Flash based content to desktop systems, alternate content to iPads. (Please no flames on Flash, it still has valid uses).

Ad-hoc iPad app installs where you would need an install link for iPad and a download link for other browsers.

This is what I'm currently using;

var agentMatch = navigator.userAgent.match(/(iPhone|iPod|iPad)/);
 window.is_AppleMobile = (typeof(agentMatch) === 'undefined') || (agentMatch === null)?false:true;

Any thoughts?

1 Answer, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 06 Sep 2013, 08:52 AM
Hello Christopher,

Using the navigator.userAgent.match() is currently the most popular way to check for mobile browsers using JavaScript. And while your code seems valid, you can organize it a bit differently, here is an example that seems to be good:

http://www.abeautifulsite.net/blog/2011/11/detecting-mobile-devices-with-javascript/
 
Regards,
Kiril Nikolov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
General Discussions
Asked by
Christopher
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Share this question
or