SlideShare a Scribd company logo
1 of 50
APACHE SLING & FRIENDS TECH MEETUP
BERLIN, 23-25 SEPTEMBER 2013
DEVICE DETECTION WITH APACHE DEVICEMAP
ANDREW SAVORY, CONRAD WOELTGE
adaptTo() 2013 2
Device Detection
adaptTo() 2013 3
I want to know, what device I run my code on.
I want to know, what device I run my code on.
adaptTo() 2013 4
 Really?
I have no idea what to do
with a T-Mobile G2x
adaptTo() 2013 5
I want to know, what the browser can do.
I want to know, what the browser can do.
adaptTo() 2013 6
adaptTo() 2013 7
Well, let’s start with a device group.
Device Groups
adaptTo() 2013 8
 smartphone
 feature phone
 touch
 tablet
 game console
 high resolution display
 modern browser
 old browser
adaptTo() 2013 9
Detection
Detect Device: I want to ...
adaptTo() 2013 10
On server side:
 Send to an optimized version of my site
 Deliver an optimized version of my site
Client Side
 Send to an optimized version of my site
 Optimize the version loaded
Detect Device
adaptTo() 2013 11
On server side:
 Deliver an optimized version of my site
RESS: “Responsive Design + Server Side
Components”
Client Side
 Optimize the version loaded
“Progressive enhancement”
adaptTo() 2013 12
Device Detection Server Side
HTTP: Device Detection Server Side
adaptTo() 2013 13
HTTP Request
GET / HTTP/1.1
Host: www.adaptto.org
User-Agent: User-Agent:Mozilla/5.0 (Linux; U; Android
4.1.2; en-gb; GT-I9305 Build/JZO54K)
AppleWebKit/534.30 (KHTML, like Gecko)
Version/4.0 Mobile Safari/534.30
Accept:
text/html,application/xhtml+xml,application/xml;q
=0.9,*/*;q=0.8
Accept-Language: en-us
Accept-Encoding: gzip, deflate
HTTP: Device Detection Server Side
adaptTo() 2013 14
User-Agent:Mozilla/5.0 (Linux; U; Android 4.1.2; en-gb;
GT-I9305 Build/JZO54K) AppleWebKit/534.30 (KHTML, like
Gecko) Version/4.0 Mobile Safari/534.30
Device Description Repository
adaptTo() 2013 15
User-Agent:Mozilla/5.0 (Linux; U;
Android 4.1.2; en-gb; GT-I9305
Build/JZO54K) AppleWebKit/534.30
(KHTML, like Gecko) Version/4.0 Mobile
Safari/534.30
Device Description
Repository
(DDR)
DDR
Device Description Repository
adaptTo() 2013 16
 WURFL (commercial license since 2011,
~30k records)
 Device Atlas
 51 Degree
 OpenDDR (Open Source)
 ...
 Various offers based on repositories
Device Description Repository
adaptTo() 2013 17
 Keep it up to date needs effort that requires
a business model as paid subscriptions
 Offers include
 Direct install
 Cloud Service calls
 Can run on each layer on your server
infrastructure
RegEx based groups
adaptTo() 2013 18
User-Agent:Mozilla/5.0 (Linux; U;
Android 4.1.2; en-gb; GT-I9305
Build/JZO54K) AppleWebKit/534.30
(KHTML, like Gecko) Version/4.0 Mobile
Safari/534.30
RewriteCond %{HTTP_USER_AGENT}
(android|bbd+|meego).+mobile|avantgo|bada/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge
|maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm(
os)?|phone|p(ixi|re)/|plucker|pocket|psp|series(4|6)0|symbian|treo|up.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino
[NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^(1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-
)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s
)|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-
|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-
7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-
c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-
|/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg(
g|/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-
| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-
|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-
2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-
)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-
|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-
|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-
v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-) [NC]
RewriteRule ^$ http://detectmobilebrowser.com/mobile [R,L]
RegEx
 mobile phone
 tablet
 modern browser
 old browser
 desktop
http://detectmobilebrowsers.com
Device Detection Server Side
adaptTo() 2013 19
Advantages
 minimize bandwidth usage
 can run effectively on each
layer on your server
infrastructure
 redirect or deliver w/in the first
request
 no requirements on client side
Disadvantages
 Might require vary-headers
caching (REST?)
 needs recent updates on DDR
or might not be precise
 performance impact if run on
every request
adaptTo() 2013 20
Device Detection Client Side
Device Capability Detection Client Side
adaptTo() 2013 21
http://tests.caniuse.com
Capability Detection Client Side
adaptTo() 2013 22
 Primarily based on JavaScript/Modernizr
 Runs on client browser
 Fundamental to “progressive enhancement”
Client Side Capability Detection
adaptTo() 2013 23
Advantages
 detects effective capabilities
(e.g. incl. current window size)
 can load resources only if a
feature is supported
 fully cacheable
Disadvantages
 needs to run on client, esp. for
redirect scenario additional
round trips
 requires JavaScript enabled
and standard compliant
browsers
adaptTo() 2013 24
Client Side Or Server Side?
Client Side Or Server Side?
adaptTo() 2013 25
 It’s not one or the other – pick what fits best!
Example
adaptTo() 2013 26
 http://www.dhl.co.uk
 Server Side Detect and Redirect:
 Mobile  m.dhl.co.uk
 anything else  www.dhl.co.uk
 Client Side:
 Responsive image handling
 Image size by effective slot size
 Image size by device-pixel-ratio
 Image quality by effective bandwidth
adaptTo() 2013 28
Practical Example
Apache DeviceMap
adaptTo() 2013 29
Apache DeviceMap
Device Description
Repository + Log Capture
Server-side device
detection (DeviceMap)
Client-side device
detection (BrowserMap)
http://www.w3.org/TR/DDR-Simple-API/
adaptTo() 2013 30
BrowserMap
BrowserMap
adaptTo() 2013 31
 YABFDL - yet another browser features
detection library
 modular probes and code snippets that
detect specific features of the client
 detect the client's type and optimize page
rendering or provide the client with alternate
website versions
 detect the device groups a client belongs to
BrowserMap Device Groups
adaptTo() 2013 32
 The following groups are provided by
default:
 smartphone - feature phones / smartphones
 tablet - various tablets, based on screen size
and the presence of touch capabilities
 highResolutionDisplay - devices with pixel
ratio greater than or equal to 2
 browser - desktop browsers capable of CSS 3D
transitions
 oldBrowser - less modern desktop browsers
adaptTo() 2013 33
Implementing Multichannel
Generate from Archetype
adaptTo() 2013 34
mvn archetype:generate
-DarchetypeGroupId=org.apache.sling
-DarchetypeArtifactId=sling-initial-content-archetype
-DarchetypeVersion=1.0.1-SNAPSHOT
groupID: org.adaptto
artifactId: multichannel
version: <default>
package: <default>
http://www.andrewsavory.com/presentations/CQCon_2013_CQ_Maven_Methods/
Aside: Yak Shaving
adaptTo() 2013 35
Yak Shaving by snapperwolf
http://www.flickr.com/photos/snapperwolf/6952219933/
Archetype fixes
adaptTo() 2013 36
[asavory@waif initial-content]$ pwd
svn-apache/sling/tooling/maven/archetypes/initial-content
[asavory@waif initial-content]$ svn status
M src/main/resources/META-INF/maven/archetype-metadata.xml
M src/main/resources/META-INF/maven/archetype.xml
A + src/main/resources/archetype-resources/src/main/resources/SLING-CONTENT
A + src/main/resources/archetype-resources/src/main/resources/SLING-CONTENT/apps
M + src/main/resources/archetype-resources/src/main/resources/SLING-CONTENT/apps/html.esp
D src/main/resources/archetype-resources/src/main/resources/SLING-CONTENT/scripts
D src/main/resources/archetype-resources/src/main/resources/SLING-CONTENT/scripts/html.esp
A src/main/resources/archetype-resources/src/main/resources/SLING-CONTENT/content/my-first-node.json
D src/main/resources/archetype-resources/src/main/resources/SLING-CONTENT/content/my-first-node.xml
D src/main/resources/archetype-resources/src/main/resources/SLING-INF
D src/main/resources/archetype-resources/src/main/resources/SLING-INF/scripts
D src/main/resources/archetype-resources/src/main/resources/SLING-INF/scripts/html.esp
D src/main/resources/archetype-resources/src/main/resources/SLING-INF/content
D src/main/resources/archetype-resources/src/main/resources/SLING-INF/content/my-first-node.xml
D src/main/resources/archetype-resources/src/main/resources/SLING-INF/nodetypes
D src/main/resources/archetype-resources/src/main/resources/SLING-INF/nodetypes/nodetypes.cnd
M src/main/resources/archetype-resources/pom.xml
Files
adaptTo() 2013 37
multichannel
|-src
|---main
|-----resources
|-------SLING-CONTENT
|---------apps
|-----------multichannel
|---------content
mvn -PautoInstallBundle install
adaptTo() 2013 38
Demo
adaptTo() 2013 39
Adding BrowserMap
Adding BrowserMap
adaptTo() 2013 40
<!-- BrowserMap feature detection library and dependencies -->
<script [..] src="/content/demo/js/browsermap/bmaputil.js"></script>
< [..] src="/content/demo/js/browsermap/bmap.js"></script>
< [..] src="/content/demo/js/externals/modernizr/modernizr.custom.js"></script>
< [..] src="/content/demo/js/externals/matchMedia/matchMedia.js"></script>
< [..] src="/content/demo/js/browsermap/probes.js"></script>
< [..] src="/content/demo/js/browsermap/devicegroups.js"></script>
<!-- Decide if the client should be forwarded to the best matching alternate link, depending on the detected
device group. -->
<script language="javascript">
BrowserMap.forwardRequest();
</script>
adaptTo() 2013 41
Demo
adaptTo() 2013 42
Controlling alternates
rel=“alternate”
adaptTo() 2013 43
 The keyword creates a hyperlink referencing an
alternate representation of the current document.
 When used with the media attribute, it means a
link to a version of the current document,
especially for the specified device or medium
indicated by the media attribute.
 A way of determining the correct URL to which a
client should be forwarded, depending on its
device group
rel=“alternate”
adaptTo() 2013 44
<link rel="alternate" hreflang="en" data-bmap-devgroups="smartphone"
href="index.smartphone.html" />
<link rel="alternate" hreflang="fr" data-bmap-devgroups="tablet"
href="/fr/index.tablet.html" />
<link rel="alternate" hreflang="de" data-bmap-
devgroups="highResolutionDisplay"
href="de/index.highResolutionDisplay.html" />
Why is “alternate” important?
adaptTo() 2013 45
Controlling BrowserMap #1
adaptTo() 2013 46
<link rel="alternate" data-bmap-devgroups="tablet" href="index.tablet.html" />
<[..] data-bmap-devgroups="smartphone" href="index.smartphone.html" />
<[..] data-bmap-devgroups="browser" href="index.browser.html" />
<[..] data-bmap-devgroups="oldBrowser" href="index.oldBrowser.html" />
{
"jcr:primaryType" : "nt:unstructured",
"sling:resourceType" : "/apps/multichannel/components/page",
"jcr:title" : "Hello World",
"title" : "Hello World",
"description" : "This node is a demo node.”,
"data-bmap-devgroups" : ["browser", "oldBrowser”, "smartphone"]
}
(+= highResolutionDisplay)
Controlling BrowserMap #2
adaptTo() 2013 47
<%
final ValueMap attributes = ResourceUtil.getValueMap(resource);
final String[] bmapDevGroups = attributes.get("data-bmap-devgroups",
String[].class);
for (String bmapDevGroup : bmapDevGroups) { %>
<link rel="alternate"
hreflang="en”
data-bmap-devgroups="<%= bmapDevGroup %>"
href="index.<%= bmapDevGroup %>-adaptTo.html" />
<%
}
%>
adaptTo() 2013 48
Demo
What’s next?
adaptTo() 2013 49
 Network speed detection (foresight.js)
 Minification / bundling of resources
 Server-side capability detection with DeviceMap
 …
References & links
adaptTo() 2013 50
 http://radu.cotescu.com/talks/2013.06.27_
BJUG13/#/
 http://incubator.apache.org/devicemap/
 https://github.com/savs/multichannel-demo
 https://github.com/raducotescu/devicemap-
demo
adaptTo() 2013 51
Thank You.
Questions?

More Related Content

What's hot

presentation timeline
presentation timelinepresentation timeline
presentation timelineRexly Lasaca
 
Epsilon CES 2017 Trend Recap
Epsilon CES 2017 Trend RecapEpsilon CES 2017 Trend Recap
Epsilon CES 2017 Trend RecapTom Edwards
 
MWC 2017: Trends & Technologies
MWC 2017: Trends & TechnologiesMWC 2017: Trends & Technologies
MWC 2017: Trends & TechnologiesKinetic Worldwide
 
Mobile World Congress 2013 Day 1 Recap - #MWC13
Mobile World Congress 2013 Day 1 Recap - #MWC13Mobile World Congress 2013 Day 1 Recap - #MWC13
Mobile World Congress 2013 Day 1 Recap - #MWC13Ogilvy
 
Fjord CES 2017: What We Saw
Fjord CES 2017: What We SawFjord CES 2017: What We Saw
Fjord CES 2017: What We SawFjord
 
CES2014 IPG Media Lab Recap
CES2014 IPG Media Lab RecapCES2014 IPG Media Lab Recap
CES2014 IPG Media Lab RecapThorsten Linz
 
PTC Announces Vuforia Chalk App for Augmented Reality Communications
PTC Announces Vuforia Chalk App for Augmented Reality CommunicationsPTC Announces Vuforia Chalk App for Augmented Reality Communications
PTC Announces Vuforia Chalk App for Augmented Reality CommunicationsPTC
 
Future of interface design 2010
Future of interface design 2010Future of interface design 2010
Future of interface design 2010Pavel Růžička
 
Android in Netbooks
Android in NetbooksAndroid in Netbooks
Android in NetbooksMike Demler
 
Latest computing devices & latest technology innovations
Latest computing devices & latest technology innovationsLatest computing devices & latest technology innovations
Latest computing devices & latest technology innovationsKhisal Iftikhar
 
Tech Trends 2015 and Beyond
Tech Trends 2015 and BeyondTech Trends 2015 and Beyond
Tech Trends 2015 and BeyondIsobar Australia
 
Thinking Outside The Little Black Box: Interaction Design in The Post-Mobile Era
Thinking Outside The Little Black Box: Interaction Design in The Post-Mobile EraThinking Outside The Little Black Box: Interaction Design in The Post-Mobile Era
Thinking Outside The Little Black Box: Interaction Design in The Post-Mobile EraJonathan Stark
 
Hot off the crowd - FABERNOVEL's watch based on crowfunding platforms // 2
Hot off the crowd - FABERNOVEL's watch based on crowfunding platforms // 2Hot off the crowd - FABERNOVEL's watch based on crowfunding platforms // 2
Hot off the crowd - FABERNOVEL's watch based on crowfunding platforms // 2Fabernovel
 
CES 2014 Recap
CES 2014 RecapCES 2014 Recap
CES 2014 RecapCake
 

What's hot (20)

presentation timeline
presentation timelinepresentation timeline
presentation timeline
 
Epsilon CES 2017 Trend Recap
Epsilon CES 2017 Trend RecapEpsilon CES 2017 Trend Recap
Epsilon CES 2017 Trend Recap
 
MWC 2017: Trends & Technologies
MWC 2017: Trends & TechnologiesMWC 2017: Trends & Technologies
MWC 2017: Trends & Technologies
 
Mobile World Congress 2013 Day 1 Recap - #MWC13
Mobile World Congress 2013 Day 1 Recap - #MWC13Mobile World Congress 2013 Day 1 Recap - #MWC13
Mobile World Congress 2013 Day 1 Recap - #MWC13
 
Fjord CES 2017: What We Saw
Fjord CES 2017: What We SawFjord CES 2017: What We Saw
Fjord CES 2017: What We Saw
 
CES2014 IPG Media Lab Recap
CES2014 IPG Media Lab RecapCES2014 IPG Media Lab Recap
CES2014 IPG Media Lab Recap
 
CES 2018: The Unicorn Files
CES 2018: The Unicorn FilesCES 2018: The Unicorn Files
CES 2018: The Unicorn Files
 
PTC Announces Vuforia Chalk App for Augmented Reality Communications
PTC Announces Vuforia Chalk App for Augmented Reality CommunicationsPTC Announces Vuforia Chalk App for Augmented Reality Communications
PTC Announces Vuforia Chalk App for Augmented Reality Communications
 
Mobile Thinking
Mobile ThinkingMobile Thinking
Mobile Thinking
 
Best of CES 2018
Best of CES 2018Best of CES 2018
Best of CES 2018
 
Digital Media and Consumer Electronics Trendspotting
Digital Media and Consumer Electronics TrendspottingDigital Media and Consumer Electronics Trendspotting
Digital Media and Consumer Electronics Trendspotting
 
2011 web game conference
2011 web game conference2011 web game conference
2011 web game conference
 
Automation
AutomationAutomation
Automation
 
Future of interface design 2010
Future of interface design 2010Future of interface design 2010
Future of interface design 2010
 
Android in Netbooks
Android in NetbooksAndroid in Netbooks
Android in Netbooks
 
Latest computing devices & latest technology innovations
Latest computing devices & latest technology innovationsLatest computing devices & latest technology innovations
Latest computing devices & latest technology innovations
 
Tech Trends 2015 and Beyond
Tech Trends 2015 and BeyondTech Trends 2015 and Beyond
Tech Trends 2015 and Beyond
 
Thinking Outside The Little Black Box: Interaction Design in The Post-Mobile Era
Thinking Outside The Little Black Box: Interaction Design in The Post-Mobile EraThinking Outside The Little Black Box: Interaction Design in The Post-Mobile Era
Thinking Outside The Little Black Box: Interaction Design in The Post-Mobile Era
 
Hot off the crowd - FABERNOVEL's watch based on crowfunding platforms // 2
Hot off the crowd - FABERNOVEL's watch based on crowfunding platforms // 2Hot off the crowd - FABERNOVEL's watch based on crowfunding platforms // 2
Hot off the crowd - FABERNOVEL's watch based on crowfunding platforms // 2
 
CES 2014 Recap
CES 2014 RecapCES 2014 Recap
CES 2014 Recap
 

Viewers also liked

Whose work is it anyway?
Whose work is it anyway?Whose work is it anyway?
Whose work is it anyway?Andrew Savory
 
Solr, Lucene, Apache, and You!
Solr, Lucene, Apache, and You!Solr, Lucene, Apache, and You!
Solr, Lucene, Apache, and You!Andrew Savory
 
CQCON CQ Maven Methods
CQCON CQ Maven MethodsCQCON CQ Maven Methods
CQCON CQ Maven MethodsAndrew Savory
 
Marketing to the Mobile Elite
Marketing to the Mobile EliteMarketing to the Mobile Elite
Marketing to the Mobile EliteAndrew Savory
 

Viewers also liked (6)

Whose work is it anyway?
Whose work is it anyway?Whose work is it anyway?
Whose work is it anyway?
 
Simplifying Cocoon
Simplifying CocoonSimplifying Cocoon
Simplifying Cocoon
 
Solr, Lucene, Apache, and You!
Solr, Lucene, Apache, and You!Solr, Lucene, Apache, and You!
Solr, Lucene, Apache, and You!
 
CQCON CQ Maven Methods
CQCON CQ Maven MethodsCQCON CQ Maven Methods
CQCON CQ Maven Methods
 
CQ Mobile Apps
CQ Mobile AppsCQ Mobile Apps
CQ Mobile Apps
 
Marketing to the Mobile Elite
Marketing to the Mobile EliteMarketing to the Mobile Elite
Marketing to the Mobile Elite
 

Similar to AdaptTo 2013: Slinging multichannel content the BrowserMap way / Device Detection

Getting started with android dev and test perspective
Getting started with android   dev and test perspectiveGetting started with android   dev and test perspective
Getting started with android dev and test perspectiveGunjan Kumar
 
Android on Windows 11 - A Developer's Perspective (Windows Subsystem For Andr...
Android on Windows 11 - A Developer's Perspective (Windows Subsystem For Andr...Android on Windows 11 - A Developer's Perspective (Windows Subsystem For Andr...
Android on Windows 11 - A Developer's Perspective (Windows Subsystem For Andr...Embarcadero Technologies
 
Optimizing your Android App for Mass Market Devices
Optimizing your Android App for Mass Market DevicesOptimizing your Android App for Mass Market Devices
Optimizing your Android App for Mass Market DevicesMotorola Mobility - MOTODEV
 
Manish Chasta - Securing Android Applications
Manish Chasta - Securing Android ApplicationsManish Chasta - Securing Android Applications
Manish Chasta - Securing Android ApplicationsPositive Hack Days
 
Android 3.1 - Portland Code Camp 2011
Android 3.1 - Portland Code Camp 2011Android 3.1 - Portland Code Camp 2011
Android 3.1 - Portland Code Camp 2011sullis
 
Android Programming Basics
Android Programming BasicsAndroid Programming Basics
Android Programming BasicsEueung Mulyana
 
The Magic of flutter Comex oman 2019
The Magic of flutter Comex oman 2019The Magic of flutter Comex oman 2019
The Magic of flutter Comex oman 2019Ahmed Abu Eldahab
 
Programming objects with android
Programming objects with androidProgramming objects with android
Programming objects with androidfirenze-gtug
 
Android – As a tool of innovation
Android – As a tool of innovation Android – As a tool of innovation
Android – As a tool of innovation Pallab Sarkar
 
Unit 1-android-and-its-tools-ass
Unit 1-android-and-its-tools-assUnit 1-android-and-its-tools-ass
Unit 1-android-and-its-tools-assARVIND SARDAR
 
Android Meetup, Илья Лёвин
Android Meetup, Илья ЛёвинAndroid Meetup, Илья Лёвин
Android Meetup, Илья ЛёвинGDG Saint Petersburg
 
Chrysler Smart Screen
Chrysler Smart ScreenChrysler Smart Screen
Chrysler Smart ScreenMostafa Sameh
 
TK2323 Lecture 1 - Introduction to Mobile Application.pdf
TK2323 Lecture 1 - Introduction to Mobile Application.pdfTK2323 Lecture 1 - Introduction to Mobile Application.pdf
TK2323 Lecture 1 - Introduction to Mobile Application.pdfLam Chun
 
Android Development Overview
Android Development OverviewAndroid Development Overview
Android Development OverviewIgor Birman
 
Android 3.0 Portland Java User Group 2011-03-15
Android 3.0 Portland Java User Group 2011-03-15Android 3.0 Portland Java User Group 2011-03-15
Android 3.0 Portland Java User Group 2011-03-15sullis
 
[Droidcon Paris 2013]Multi-Versioning Android Tips
[Droidcon Paris 2013]Multi-Versioning Android Tips[Droidcon Paris 2013]Multi-Versioning Android Tips
[Droidcon Paris 2013]Multi-Versioning Android TipsKenichi Kambara
 
Using the Presentation API and external screens on Android
Using the Presentation API and external screens on AndroidUsing the Presentation API and external screens on Android
Using the Presentation API and external screens on AndroidXavier Hallade
 

Similar to AdaptTo 2013: Slinging multichannel content the BrowserMap way / Device Detection (20)

Getting started with android dev and test perspective
Getting started with android   dev and test perspectiveGetting started with android   dev and test perspective
Getting started with android dev and test perspective
 
Android on Windows 11 - A Developer's Perspective (Windows Subsystem For Andr...
Android on Windows 11 - A Developer's Perspective (Windows Subsystem For Andr...Android on Windows 11 - A Developer's Perspective (Windows Subsystem For Andr...
Android on Windows 11 - A Developer's Perspective (Windows Subsystem For Andr...
 
Optimizing your Android App for Mass Market Devices
Optimizing your Android App for Mass Market DevicesOptimizing your Android App for Mass Market Devices
Optimizing your Android App for Mass Market Devices
 
Manish Chasta - Securing Android Applications
Manish Chasta - Securing Android ApplicationsManish Chasta - Securing Android Applications
Manish Chasta - Securing Android Applications
 
Android 3.1 - Portland Code Camp 2011
Android 3.1 - Portland Code Camp 2011Android 3.1 - Portland Code Camp 2011
Android 3.1 - Portland Code Camp 2011
 
MOTOROLA XOOM Meet-up March 1st
MOTOROLA XOOM Meet-up March 1stMOTOROLA XOOM Meet-up March 1st
MOTOROLA XOOM Meet-up March 1st
 
Android Programming Basics
Android Programming BasicsAndroid Programming Basics
Android Programming Basics
 
The Magic of flutter Comex oman 2019
The Magic of flutter Comex oman 2019The Magic of flutter Comex oman 2019
The Magic of flutter Comex oman 2019
 
Programming objects with android
Programming objects with androidProgramming objects with android
Programming objects with android
 
Android – As a tool of innovation
Android – As a tool of innovation Android – As a tool of innovation
Android – As a tool of innovation
 
Unit 1-android-and-its-tools-ass
Unit 1-android-and-its-tools-assUnit 1-android-and-its-tools-ass
Unit 1-android-and-its-tools-ass
 
Android Meetup, Илья Лёвин
Android Meetup, Илья ЛёвинAndroid Meetup, Илья Лёвин
Android Meetup, Илья Лёвин
 
Chrysler Smart Screen
Chrysler Smart ScreenChrysler Smart Screen
Chrysler Smart Screen
 
TK2323 Lecture 1 - Introduction to Mobile Application.pdf
TK2323 Lecture 1 - Introduction to Mobile Application.pdfTK2323 Lecture 1 - Introduction to Mobile Application.pdf
TK2323 Lecture 1 - Introduction to Mobile Application.pdf
 
Android
AndroidAndroid
Android
 
Android Development Overview
Android Development OverviewAndroid Development Overview
Android Development Overview
 
Designing Apps for the Motorola XOOM
Designing Apps for the Motorola XOOM Designing Apps for the Motorola XOOM
Designing Apps for the Motorola XOOM
 
Android 3.0 Portland Java User Group 2011-03-15
Android 3.0 Portland Java User Group 2011-03-15Android 3.0 Portland Java User Group 2011-03-15
Android 3.0 Portland Java User Group 2011-03-15
 
[Droidcon Paris 2013]Multi-Versioning Android Tips
[Droidcon Paris 2013]Multi-Versioning Android Tips[Droidcon Paris 2013]Multi-Versioning Android Tips
[Droidcon Paris 2013]Multi-Versioning Android Tips
 
Using the Presentation API and external screens on Android
Using the Presentation API and external screens on AndroidUsing the Presentation API and external screens on Android
Using the Presentation API and external screens on Android
 

More from Andrew Savory

Economics of innovation in mobile
Economics of innovation in mobileEconomics of innovation in mobile
Economics of innovation in mobileAndrew Savory
 
Mobile distributions and upstream challenges
Mobile distributions and upstream challengesMobile distributions and upstream challenges
Mobile distributions and upstream challengesAndrew Savory
 
Open source in mobile
Open source in mobileOpen source in mobile
Open source in mobileAndrew Savory
 
Open Apps - Good, Bad or Ugly?
Open Apps - Good, Bad or Ugly?Open Apps - Good, Bad or Ugly?
Open Apps - Good, Bad or Ugly?Andrew Savory
 
Collaborative Development for the future of Mobile
Collaborative Development for the future of MobileCollaborative Development for the future of Mobile
Collaborative Development for the future of MobileAndrew Savory
 
A to z of open mobile
A to z of open mobileA to z of open mobile
A to z of open mobileAndrew Savory
 

More from Andrew Savory (8)

Economics of innovation in mobile
Economics of innovation in mobileEconomics of innovation in mobile
Economics of innovation in mobile
 
XML and XSLT
XML and XSLTXML and XSLT
XML and XSLT
 
What Students Want
What Students WantWhat Students Want
What Students Want
 
Mobile distributions and upstream challenges
Mobile distributions and upstream challengesMobile distributions and upstream challenges
Mobile distributions and upstream challenges
 
Open source in mobile
Open source in mobileOpen source in mobile
Open source in mobile
 
Open Apps - Good, Bad or Ugly?
Open Apps - Good, Bad or Ugly?Open Apps - Good, Bad or Ugly?
Open Apps - Good, Bad or Ugly?
 
Collaborative Development for the future of Mobile
Collaborative Development for the future of MobileCollaborative Development for the future of Mobile
Collaborative Development for the future of Mobile
 
A to z of open mobile
A to z of open mobileA to z of open mobile
A to z of open mobile
 

Recently uploaded

MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 

Recently uploaded (20)

MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 

AdaptTo 2013: Slinging multichannel content the BrowserMap way / Device Detection

  • 1. APACHE SLING & FRIENDS TECH MEETUP BERLIN, 23-25 SEPTEMBER 2013 DEVICE DETECTION WITH APACHE DEVICEMAP ANDREW SAVORY, CONRAD WOELTGE
  • 3. adaptTo() 2013 3 I want to know, what device I run my code on.
  • 4. I want to know, what device I run my code on. adaptTo() 2013 4  Really? I have no idea what to do with a T-Mobile G2x
  • 5. adaptTo() 2013 5 I want to know, what the browser can do.
  • 6. I want to know, what the browser can do. adaptTo() 2013 6
  • 7. adaptTo() 2013 7 Well, let’s start with a device group.
  • 8. Device Groups adaptTo() 2013 8  smartphone  feature phone  touch  tablet  game console  high resolution display  modern browser  old browser
  • 10. Detect Device: I want to ... adaptTo() 2013 10 On server side:  Send to an optimized version of my site  Deliver an optimized version of my site Client Side  Send to an optimized version of my site  Optimize the version loaded
  • 11. Detect Device adaptTo() 2013 11 On server side:  Deliver an optimized version of my site RESS: “Responsive Design + Server Side Components” Client Side  Optimize the version loaded “Progressive enhancement”
  • 12. adaptTo() 2013 12 Device Detection Server Side
  • 13. HTTP: Device Detection Server Side adaptTo() 2013 13 HTTP Request GET / HTTP/1.1 Host: www.adaptto.org User-Agent: User-Agent:Mozilla/5.0 (Linux; U; Android 4.1.2; en-gb; GT-I9305 Build/JZO54K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 Accept: text/html,application/xhtml+xml,application/xml;q =0.9,*/*;q=0.8 Accept-Language: en-us Accept-Encoding: gzip, deflate
  • 14. HTTP: Device Detection Server Side adaptTo() 2013 14 User-Agent:Mozilla/5.0 (Linux; U; Android 4.1.2; en-gb; GT-I9305 Build/JZO54K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30
  • 15. Device Description Repository adaptTo() 2013 15 User-Agent:Mozilla/5.0 (Linux; U; Android 4.1.2; en-gb; GT-I9305 Build/JZO54K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 Device Description Repository (DDR) DDR
  • 16. Device Description Repository adaptTo() 2013 16  WURFL (commercial license since 2011, ~30k records)  Device Atlas  51 Degree  OpenDDR (Open Source)  ...  Various offers based on repositories
  • 17. Device Description Repository adaptTo() 2013 17  Keep it up to date needs effort that requires a business model as paid subscriptions  Offers include  Direct install  Cloud Service calls  Can run on each layer on your server infrastructure
  • 18. RegEx based groups adaptTo() 2013 18 User-Agent:Mozilla/5.0 (Linux; U; Android 4.1.2; en-gb; GT-I9305 Build/JZO54K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 RewriteCond %{HTTP_USER_AGENT} (android|bbd+|meego).+mobile|avantgo|bada/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)/|plucker|pocket|psp|series(4|6)0|symbian|treo|up.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino [NC,OR] RewriteCond %{HTTP_USER_AGENT} ^(1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s- )|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55/|capi|ccwa|cdm-|cell|chtm|cldc|cmd- |co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4- 7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs- c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |- |/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(- | |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)- |on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn- 2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i- )|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(- |m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg- |tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|- v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-) [NC] RewriteRule ^$ http://detectmobilebrowser.com/mobile [R,L] RegEx  mobile phone  tablet  modern browser  old browser  desktop http://detectmobilebrowsers.com
  • 19. Device Detection Server Side adaptTo() 2013 19 Advantages  minimize bandwidth usage  can run effectively on each layer on your server infrastructure  redirect or deliver w/in the first request  no requirements on client side Disadvantages  Might require vary-headers caching (REST?)  needs recent updates on DDR or might not be precise  performance impact if run on every request
  • 20. adaptTo() 2013 20 Device Detection Client Side
  • 21. Device Capability Detection Client Side adaptTo() 2013 21 http://tests.caniuse.com
  • 22. Capability Detection Client Side adaptTo() 2013 22  Primarily based on JavaScript/Modernizr  Runs on client browser  Fundamental to “progressive enhancement”
  • 23. Client Side Capability Detection adaptTo() 2013 23 Advantages  detects effective capabilities (e.g. incl. current window size)  can load resources only if a feature is supported  fully cacheable Disadvantages  needs to run on client, esp. for redirect scenario additional round trips  requires JavaScript enabled and standard compliant browsers
  • 24. adaptTo() 2013 24 Client Side Or Server Side?
  • 25. Client Side Or Server Side? adaptTo() 2013 25  It’s not one or the other – pick what fits best!
  • 26. Example adaptTo() 2013 26  http://www.dhl.co.uk  Server Side Detect and Redirect:  Mobile  m.dhl.co.uk  anything else  www.dhl.co.uk  Client Side:  Responsive image handling  Image size by effective slot size  Image size by device-pixel-ratio  Image quality by effective bandwidth
  • 28. Apache DeviceMap adaptTo() 2013 29 Apache DeviceMap Device Description Repository + Log Capture Server-side device detection (DeviceMap) Client-side device detection (BrowserMap) http://www.w3.org/TR/DDR-Simple-API/
  • 30. BrowserMap adaptTo() 2013 31  YABFDL - yet another browser features detection library  modular probes and code snippets that detect specific features of the client  detect the client's type and optimize page rendering or provide the client with alternate website versions  detect the device groups a client belongs to
  • 31. BrowserMap Device Groups adaptTo() 2013 32  The following groups are provided by default:  smartphone - feature phones / smartphones  tablet - various tablets, based on screen size and the presence of touch capabilities  highResolutionDisplay - devices with pixel ratio greater than or equal to 2  browser - desktop browsers capable of CSS 3D transitions  oldBrowser - less modern desktop browsers
  • 33. Generate from Archetype adaptTo() 2013 34 mvn archetype:generate -DarchetypeGroupId=org.apache.sling -DarchetypeArtifactId=sling-initial-content-archetype -DarchetypeVersion=1.0.1-SNAPSHOT groupID: org.adaptto artifactId: multichannel version: <default> package: <default> http://www.andrewsavory.com/presentations/CQCon_2013_CQ_Maven_Methods/
  • 34. Aside: Yak Shaving adaptTo() 2013 35 Yak Shaving by snapperwolf http://www.flickr.com/photos/snapperwolf/6952219933/
  • 35. Archetype fixes adaptTo() 2013 36 [asavory@waif initial-content]$ pwd svn-apache/sling/tooling/maven/archetypes/initial-content [asavory@waif initial-content]$ svn status M src/main/resources/META-INF/maven/archetype-metadata.xml M src/main/resources/META-INF/maven/archetype.xml A + src/main/resources/archetype-resources/src/main/resources/SLING-CONTENT A + src/main/resources/archetype-resources/src/main/resources/SLING-CONTENT/apps M + src/main/resources/archetype-resources/src/main/resources/SLING-CONTENT/apps/html.esp D src/main/resources/archetype-resources/src/main/resources/SLING-CONTENT/scripts D src/main/resources/archetype-resources/src/main/resources/SLING-CONTENT/scripts/html.esp A src/main/resources/archetype-resources/src/main/resources/SLING-CONTENT/content/my-first-node.json D src/main/resources/archetype-resources/src/main/resources/SLING-CONTENT/content/my-first-node.xml D src/main/resources/archetype-resources/src/main/resources/SLING-INF D src/main/resources/archetype-resources/src/main/resources/SLING-INF/scripts D src/main/resources/archetype-resources/src/main/resources/SLING-INF/scripts/html.esp D src/main/resources/archetype-resources/src/main/resources/SLING-INF/content D src/main/resources/archetype-resources/src/main/resources/SLING-INF/content/my-first-node.xml D src/main/resources/archetype-resources/src/main/resources/SLING-INF/nodetypes D src/main/resources/archetype-resources/src/main/resources/SLING-INF/nodetypes/nodetypes.cnd M src/main/resources/archetype-resources/pom.xml
  • 39. Adding BrowserMap adaptTo() 2013 40 <!-- BrowserMap feature detection library and dependencies --> <script [..] src="/content/demo/js/browsermap/bmaputil.js"></script> < [..] src="/content/demo/js/browsermap/bmap.js"></script> < [..] src="/content/demo/js/externals/modernizr/modernizr.custom.js"></script> < [..] src="/content/demo/js/externals/matchMedia/matchMedia.js"></script> < [..] src="/content/demo/js/browsermap/probes.js"></script> < [..] src="/content/demo/js/browsermap/devicegroups.js"></script> <!-- Decide if the client should be forwarded to the best matching alternate link, depending on the detected device group. --> <script language="javascript"> BrowserMap.forwardRequest(); </script>
  • 42. rel=“alternate” adaptTo() 2013 43  The keyword creates a hyperlink referencing an alternate representation of the current document.  When used with the media attribute, it means a link to a version of the current document, especially for the specified device or medium indicated by the media attribute.  A way of determining the correct URL to which a client should be forwarded, depending on its device group
  • 43. rel=“alternate” adaptTo() 2013 44 <link rel="alternate" hreflang="en" data-bmap-devgroups="smartphone" href="index.smartphone.html" /> <link rel="alternate" hreflang="fr" data-bmap-devgroups="tablet" href="/fr/index.tablet.html" /> <link rel="alternate" hreflang="de" data-bmap- devgroups="highResolutionDisplay" href="de/index.highResolutionDisplay.html" />
  • 44. Why is “alternate” important? adaptTo() 2013 45
  • 45. Controlling BrowserMap #1 adaptTo() 2013 46 <link rel="alternate" data-bmap-devgroups="tablet" href="index.tablet.html" /> <[..] data-bmap-devgroups="smartphone" href="index.smartphone.html" /> <[..] data-bmap-devgroups="browser" href="index.browser.html" /> <[..] data-bmap-devgroups="oldBrowser" href="index.oldBrowser.html" /> { "jcr:primaryType" : "nt:unstructured", "sling:resourceType" : "/apps/multichannel/components/page", "jcr:title" : "Hello World", "title" : "Hello World", "description" : "This node is a demo node.”, "data-bmap-devgroups" : ["browser", "oldBrowser”, "smartphone"] } (+= highResolutionDisplay)
  • 46. Controlling BrowserMap #2 adaptTo() 2013 47 <% final ValueMap attributes = ResourceUtil.getValueMap(resource); final String[] bmapDevGroups = attributes.get("data-bmap-devgroups", String[].class); for (String bmapDevGroup : bmapDevGroups) { %> <link rel="alternate" hreflang="en” data-bmap-devgroups="<%= bmapDevGroup %>" href="index.<%= bmapDevGroup %>-adaptTo.html" /> <% } %>
  • 48. What’s next? adaptTo() 2013 49  Network speed detection (foresight.js)  Minification / bundling of resources  Server-side capability detection with DeviceMap  …
  • 49. References & links adaptTo() 2013 50  http://radu.cotescu.com/talks/2013.06.27_ BJUG13/#/  http://incubator.apache.org/devicemap/  https://github.com/savs/multichannel-demo  https://github.com/raducotescu/devicemap- demo
  • 50. adaptTo() 2013 51 Thank You. Questions?

Editor's Notes

  1. DDR based on Device Description Repository Simple API W3C Recommendation 05 December 2008… describes a simple API for access to DDRs, in order to ease and promote the development of Web content that adapts to its Delivery Context.Java, VBNet, c#
  2. AEM supports device client-side detection based on BrowserMap. BrowserMap is shipped in AEM as a client library under /etc/clientlibs/browsermap.
  3. W3C: HTML5 spec
  4. SEO(also the right thing to do)