SlideShare a Scribd company logo
1 of 46
Download to read offline
The Mobile Web on Drupal!




Thursday, January 13, 2011
Where are we going today?

               Mobile Web development theories and philosophies
               Reality check!
               Core tenets I like to stick to
               So, about Drupal...the good and the bad
               Digging in and putting some pieces together (CODE!)
               Stuff to read so you can learn more




Thursday, January 13, 2011
How technical is this going to be?


                     Weā€™ll start high level (everyone)

                     Weā€™ll talk about strategy and device grouping (everyone/solution architects)

                     Weā€™ll talk about Drupalā€™s strengths and weaknesses and 3rd-party stuff.
                     (everyone/somewhat technical)

                     Weā€™ll look at code for a hypothetical module and work with Drupal hooks and
                     whatnot. (devs/code)

                     Weā€™ll talk about mobile theming strategy. (designers)

                     Iā€™ll recommend some books, blogs and mailing lists. (everyone)




Thursday, January 13, 2011
Nope.
               This topic is huge. We wonā€™t have time to talk about:
                     Detailed (HTML/CSS) markup for mobile devices.
                     The ļ¬ner points of device-speciļ¬c support for
                     technologies (CSS/JS/HTML5/whatever).
                     Design and UX best practices.
                     Testing.
                     All of these areas are incredibly important,
                     though!



Thursday, January 13, 2011
By The Way



               This presentation is
               based on Drupal 6

                                      My current feeling about D7*




       * Sorry
Thursday, January 13, 2011
Leading Philosophies of
          Mobile Web Development



Thursday, January 13, 2011
The ā€œOne Webā€




Thursday, January 13, 2011
One Web means making, as far as is reasonable, the
                             same information and services available to users
                             irrespective of the device they are using. However, it
                             does not mean that exactly the same information is available in
                             exactly the same representation across all devices. The context
                             of mobile use, device capability variations, bandwidth issues and
                             mobile network capabilities all affect the representation...

                             ...it is considered best practice to provide as reasonable
                             experience as is possible given device limitations and not to
                             exclude access from any particular class of device, except
                             where this is necessary because of device
                             limitations....


                                                                                     Errr...




Thursday, January 13, 2011
That means...

               Separate mobile site or domain (e.g. m.mysite.com) is
               discouraged.
               All users should get, for the most part, the same text,
               features, markup, images, functionality, etc. (within
               reason, which you get to determine).
               Develop once (I do like this part).




Thursday, January 13, 2011
Responsive Web Design (RWD)




Thursday, January 13, 2011
RWD
               Using sophisticated markup and CSS techniques to
               make the ā€œOne Webā€ ideal more attainable.
               Using CSS Media Queries to adapt content, allowing
               for ā€œOne Webā€ success
               Fluid grid designs
               For the most part, send the same HTML markup and
               media (e.g. images) to everyone
               http://www.alistapart.com/articles/responsive-web-
               design/



Thursday, January 13, 2011
I am a CSS Media Query:

                             <link rel="stylesheet" type="text/css"
                               media="screen and (max-device-width: 480px)"
                               href="shetland.css" />




Thursday, January 13, 2011
Progressive Enhancement




Thursday, January 13, 2011
Progressive Enhancement


               Not just a mobile concern
               Luke Wā€™s ā€œMobile Firstā€ credo is in the same family
                     Design your baseline site for mobile, then go from
                     there
                     http://www.lukew.com/ff/entry.asp?933




Thursday, January 13, 2011
Server-Side Device Detection and
          Adaptation




Thursday, January 13, 2011
Who goes there?




Thursday, January 13, 2011
Server-Side Device Detection

               Based on using User Agent strings to make an
               educated guess at what a device is and what
               capabilities it has
               Several device libraries support this. Two of the best
               known are:
                     WURFL
                     DeviceAtlas




Thursday, January 13, 2011
WURFL

               http://wurļ¬‚.sourceforge.net/
               Maintained/moderated by Luca Passani.
               Exhaustive details about mobile device and client
               capabilities based on User Agent.
               Contributors have created APIs in several languages.
               Free and open source.




Thursday, January 13, 2011
Letā€™s Look at some WURFL Capabilities




               Tera-WURFL Explorer
                     http://www.tera-wurļ¬‚.com/explore/




Thursday, January 13, 2011
DeviceAtlas

               Licenses run from $99/yr (per server) to ... well, more.
                     You get guaranteed updates.
                     API is PHP, Java, .Net
                     Analytics as well.
               Web site is free and a useful reference for looking up
               devices right quick.
               http://deviceatlas.com



Thursday, January 13, 2011
Client-Side Adaptation




Thursday, January 13, 2011
Whereas server-side detection asks ā€œWho
          goes there?,ā€ client-side adaptation allows
          you to say things like:




Thursday, January 13, 2011
Oh, yeah? prove it.




Thursday, January 13, 2011
Client-Side Adaptation


               Determining real client capabilities a la Modernizr
               Using CSS Media queries
               Taking delivered markup the ļ¬nal mile
               Ensures that the client can walk the walk




Thursday, January 13, 2011
Modernizr (A Quick Aside)
               Runs tests on the client
               Adds CSS classes to the <html> element based on
               what it discovers
               You, noble developer/themer, can:
                     Write your CSS accordingly
                     Use JavaScript to extend your stuff
               Based on what the browser can actually do
               http://www.modernizr.com


Thursday, January 13, 2011
So, that all sounds lovely and clean and
          unicorn-shaped.




Thursday, January 13, 2011
The Reality




Thursday, January 13, 2011
Thursday, January 13, 2011
ā€œOne Webā€ is vague
                             Dear Puny Human,

                             Make one Web site such that itā€™s, like, the same on all devices,
                             except, well, make sure that it is appropriately different on some
                             devices. Donā€™t exclude anyone, except when ā€œdevice limitationsā€
                             force you to.

                             Iā€™ll leave deciding what a device limitation is as an exercise for
                             the reader.

                                                                               Love,
                                                                            The W3C
                                                              http://www.w3.org/TR/mobile-bp/#OneWeb




Thursday, January 13, 2011
RWD has performance and bandwidth implications

               Image resizing on devices can be inefļ¬cient and uses
               bandwidth you might not need to use.
               CSS media query support is fragmented and only on
               modern devices.
               For the most part, images hidden in CSS still get
               downloaded.
               Weā€™re sending the device bytes that it is not going to
               use.
               http://www.cloudfour.com/css-media-query-for-mobile-
               is-fools-gold/


Thursday, January 13, 2011
Shoving a 153,600-pixel image at a phone that only has about
                             16,000 pixels of real estate to work with is like giving 4-by-8-
                             foot sheets of plywood to a kid who wants to build a miniature
                             birdhouse. Even if wood is cheap, it tastelessly wastes a lot of
                             trees...




                                                                                    ā€”Lyza    Gardner (Me)
                                                           Adventures on the Mobile Web Frontier, Nov. 4, 2010



                                                                                                                 *
                                  http://www.cloudfour.com/adventures-on-the-mobile-web-frontier-wrangling-
                                           drupal-third-party-apis-and-server-oomph-into-an-enterprise-class-
                                                                                                 experience/



                                 * Sorry about that URL; my bad
Thursday, January 13, 2011
Server-side device detection via UA is not infallible...


                    Who goes
                     there?




                               Hello, Web
                               Server, I am a
                               sheep!


Thursday, January 13, 2011
Who goes
                     there?




                                         Web Server! I am
                                         also a sheep!*
                  *Not really a sheep.
Thursday, January 13, 2011
Client-side enhancement can be pretty tricky if your
          userā€™s device isnā€™t up to it


                                 ā€œHi, Iā€™m BlackBerry version 4.5. Youā€™d be
                                 surprised at how many people at big
                                 companies still use me and love me.

                                 You cannot manipulate my DOM and my
                                 JavaScript performance is very sad.

                                 Sorry.ā€




Thursday, January 13, 2011
Thursday, January 13, 2011
Duct Tape Programming

               ā€œDuct tape programmers are pragmatic...

               ā€œA 50%-good solution that people actually have solves more problems and survives
               longer than a 99% solution that nobody has because itā€™s in your lab where youā€™re
               endlessly polishing the damn thing.


               ā€œShipping is a feature. A really important
               feature. Your product must have it.ā€


                                                                                              ā€”Joel   Spolsky
                                                                        The Duct Tape Programmer, Sept. 23, 2009
                                                                                              Joel on Software
                                                             http://www.joelonsoftware.com/items/2009/09/23.html




Thursday, January 13, 2011
Thursday, January 13, 2011
So, how do we keep our nose clean in
          this tragicomical environment?
          Staying True to a Couple of Tenets...




Thursday, January 13, 2011
1. Donā€™t send bits to a
           device that it wonā€™t use



Thursday, January 13, 2011
bits == dollars
          bits == waiting
          bits ~= processing


Thursday, January 13, 2011
2. The client is always
          right*

                             * This one gets me in a bit of trouble




Thursday, January 13, 2011
Remember how I said that User Agents
          arenā€™t always 100% honest and
          forthcoming? Or, at least, sane?




Thursday, January 13, 2011
Whose User Agent is this?


               Mozilla/5.0 (Macintosh; U; Intel Mac OS X
               10_5_7; en-us) AppleWebKit/530.17 (KHTML, like
               Gecko) Version/4.0
               Safari/530.17




Thursday, January 13, 2011
A Sane Person would guess...



               Desktop Safari
               And thatā€™s what WURFL will tell you, too




Thursday, January 13, 2011
But




               Itā€™s Skyļ¬re for Android.




Thursday, January 13, 2011
ā€œLoad web pages as either traditional Android user agent or as
                              a desktop browser. The desktop option gives you more
                              ļ¬‚exibility in accessing web sites and allows discovery of video
                              content that might not be visible on the mobile site.ā€




                             Laughing all the way to the Bank or whatever,
                                                                    Love,
                                                                   Skyļ¬re


                                                                                      Skyļ¬re Web Site
                                                                http://www.skyļ¬re.com/product/android




Thursday, January 13, 2011

More Related Content

Similar to Mobile Web on Drupal!

Drupal camp atlanta 2013 mobile first
Drupal camp atlanta 2013 mobile firstDrupal camp atlanta 2013 mobile first
Drupal camp atlanta 2013 mobile firsttobbyhagler
Ā 
Angular js mobile jsday 2014 - Verona 14 may
Angular js mobile   jsday 2014 - Verona 14 mayAngular js mobile   jsday 2014 - Verona 14 may
Angular js mobile jsday 2014 - Verona 14 mayLuciano Amodio
Ā 
Gregynog 2011
Gregynog 2011Gregynog 2011
Gregynog 2011gregynog
Ā 
Seminar Android - Pengenalan PhoneGap
Seminar Android - Pengenalan PhoneGapSeminar Android - Pengenalan PhoneGap
Seminar Android - Pengenalan PhoneGapNur Hidayat
Ā 
Drupalcamp LA Aug 2009
Drupalcamp LA Aug 2009Drupalcamp LA Aug 2009
Drupalcamp LA Aug 2009Tom Deryckere
Ā 
Brian Hogg - Web Apps using HTML5 and JS
Brian Hogg - Web Apps using HTML5 and JSBrian Hogg - Web Apps using HTML5 and JS
Brian Hogg - Web Apps using HTML5 and JS#DevTO
Ā 
Briding the Gap between Desktop and Mobile publishing
Briding the Gap between Desktop and Mobile publishingBriding the Gap between Desktop and Mobile publishing
Briding the Gap between Desktop and Mobile publishingTom Deryckere
Ā 
Let's Take Drupal Offline!
Let's Take Drupal Offline!Let's Take Drupal Offline!
Let's Take Drupal Offline!Dick Olsson
Ā 
Mobile Apps at NCSU Libraries
Mobile Apps at NCSU LibrariesMobile Apps at NCSU Libraries
Mobile Apps at NCSU LibrariesCory Lown
Ā 
14 technologies every web developer should be able to understand
14 technologies every web developer should be able to understand14 technologies every web developer should be able to understand
14 technologies every web developer should be able to understandUm e Farwa
Ā 
Joshfire Factory: Building Apps for Billion of Devices
Joshfire Factory: Building Apps for Billion of DevicesJoshfire Factory: Building Apps for Billion of Devices
Joshfire Factory: Building Apps for Billion of DevicesFrancois Daoust
Ā 
Mobilizing the User Experience
Mobilizing the User ExperienceMobilizing the User Experience
Mobilizing the User ExperienceNina McHale
Ā 
Javascript Frameworks Comparison - Angular, Knockout, Ember and Backbone
Javascript Frameworks Comparison - Angular, Knockout, Ember and BackboneJavascript Frameworks Comparison - Angular, Knockout, Ember and Backbone
Javascript Frameworks Comparison - Angular, Knockout, Ember and BackboneDeepu S Nath
Ā 
Transmission2 25.11.2009
Transmission2 25.11.2009Transmission2 25.11.2009
Transmission2 25.11.2009Patrick Lauke
Ā 
Plan For Accessibility - TODCon 2008
Plan For Accessibility - TODCon 2008Plan For Accessibility - TODCon 2008
Plan For Accessibility - TODCon 2008Denise Jacobs
Ā 
Java Swing vs. Android App
Java Swing vs. Android AppJava Swing vs. Android App
Java Swing vs. Android AppJohnny Hujol
Ā 
Webtech 17.11.2009
Webtech 17.11.2009Webtech 17.11.2009
Webtech 17.11.2009Patrick Lauke
Ā 
Mobile tech briefing 2013
Mobile tech briefing 2013Mobile tech briefing 2013
Mobile tech briefing 2013Scotty Logan
Ā 
Building a Simple Mobile-optimized Web App Using the jQuery Mobile Framework
Building a Simple Mobile-optimized Web App Using the jQuery Mobile FrameworkBuilding a Simple Mobile-optimized Web App Using the jQuery Mobile Framework
Building a Simple Mobile-optimized Web App Using the jQuery Mobile FrameworkSt. Petersburg College
Ā 
Best Practices in Mobile Development: Building Your First jQuery Mobile App
Best Practices in Mobile Development: Building Your First jQuery Mobile AppBest Practices in Mobile Development: Building Your First jQuery Mobile App
Best Practices in Mobile Development: Building Your First jQuery Mobile AppSt. Petersburg College
Ā 

Similar to Mobile Web on Drupal! (20)

Drupal camp atlanta 2013 mobile first
Drupal camp atlanta 2013 mobile firstDrupal camp atlanta 2013 mobile first
Drupal camp atlanta 2013 mobile first
Ā 
Angular js mobile jsday 2014 - Verona 14 may
Angular js mobile   jsday 2014 - Verona 14 mayAngular js mobile   jsday 2014 - Verona 14 may
Angular js mobile jsday 2014 - Verona 14 may
Ā 
Gregynog 2011
Gregynog 2011Gregynog 2011
Gregynog 2011
Ā 
Seminar Android - Pengenalan PhoneGap
Seminar Android - Pengenalan PhoneGapSeminar Android - Pengenalan PhoneGap
Seminar Android - Pengenalan PhoneGap
Ā 
Drupalcamp LA Aug 2009
Drupalcamp LA Aug 2009Drupalcamp LA Aug 2009
Drupalcamp LA Aug 2009
Ā 
Brian Hogg - Web Apps using HTML5 and JS
Brian Hogg - Web Apps using HTML5 and JSBrian Hogg - Web Apps using HTML5 and JS
Brian Hogg - Web Apps using HTML5 and JS
Ā 
Briding the Gap between Desktop and Mobile publishing
Briding the Gap between Desktop and Mobile publishingBriding the Gap between Desktop and Mobile publishing
Briding the Gap between Desktop and Mobile publishing
Ā 
Let's Take Drupal Offline!
Let's Take Drupal Offline!Let's Take Drupal Offline!
Let's Take Drupal Offline!
Ā 
Mobile Apps at NCSU Libraries
Mobile Apps at NCSU LibrariesMobile Apps at NCSU Libraries
Mobile Apps at NCSU Libraries
Ā 
14 technologies every web developer should be able to understand
14 technologies every web developer should be able to understand14 technologies every web developer should be able to understand
14 technologies every web developer should be able to understand
Ā 
Joshfire Factory: Building Apps for Billion of Devices
Joshfire Factory: Building Apps for Billion of DevicesJoshfire Factory: Building Apps for Billion of Devices
Joshfire Factory: Building Apps for Billion of Devices
Ā 
Mobilizing the User Experience
Mobilizing the User ExperienceMobilizing the User Experience
Mobilizing the User Experience
Ā 
Javascript Frameworks Comparison - Angular, Knockout, Ember and Backbone
Javascript Frameworks Comparison - Angular, Knockout, Ember and BackboneJavascript Frameworks Comparison - Angular, Knockout, Ember and Backbone
Javascript Frameworks Comparison - Angular, Knockout, Ember and Backbone
Ā 
Transmission2 25.11.2009
Transmission2 25.11.2009Transmission2 25.11.2009
Transmission2 25.11.2009
Ā 
Plan For Accessibility - TODCon 2008
Plan For Accessibility - TODCon 2008Plan For Accessibility - TODCon 2008
Plan For Accessibility - TODCon 2008
Ā 
Java Swing vs. Android App
Java Swing vs. Android AppJava Swing vs. Android App
Java Swing vs. Android App
Ā 
Webtech 17.11.2009
Webtech 17.11.2009Webtech 17.11.2009
Webtech 17.11.2009
Ā 
Mobile tech briefing 2013
Mobile tech briefing 2013Mobile tech briefing 2013
Mobile tech briefing 2013
Ā 
Building a Simple Mobile-optimized Web App Using the jQuery Mobile Framework
Building a Simple Mobile-optimized Web App Using the jQuery Mobile FrameworkBuilding a Simple Mobile-optimized Web App Using the jQuery Mobile Framework
Building a Simple Mobile-optimized Web App Using the jQuery Mobile Framework
Ā 
Best Practices in Mobile Development: Building Your First jQuery Mobile App
Best Practices in Mobile Development: Building Your First jQuery Mobile AppBest Practices in Mobile Development: Building Your First jQuery Mobile App
Best Practices in Mobile Development: Building Your First jQuery Mobile App
Ā 

Recently uploaded

SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
Ā 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
Ā 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
Ā 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
Ā 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
Ā 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
Ā 
SIEMENS: RAPUNZEL ā€“ A Tale About Knowledge Graph
SIEMENS: RAPUNZEL ā€“ A Tale About Knowledge GraphSIEMENS: RAPUNZEL ā€“ A Tale About Knowledge Graph
SIEMENS: RAPUNZEL ā€“ A Tale About Knowledge GraphNeo4j
Ā 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
Ā 
Bun (KitWorks Team Study ė…øė³„ė§ˆė£Ø ė°œķ‘œ 2024.4.22)
Bun (KitWorks Team Study ė…øė³„ė§ˆė£Ø ė°œķ‘œ 2024.4.22)Bun (KitWorks Team Study ė…øė³„ė§ˆė£Ø ė°œķ‘œ 2024.4.22)
Bun (KitWorks Team Study ė…øė³„ė§ˆė£Ø ė°œķ‘œ 2024.4.22)Wonjun Hwang
Ā 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
Ā 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
Ā 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
Ā 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
Ā 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
Ā 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
Ā 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsAndrey Dotsenko
Ā 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
Ā 

Recently uploaded (20)

SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
Ā 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
Ā 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
Ā 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
Ā 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
Ā 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Ā 
Hot Sexy call girls in Panjabi Bagh šŸ” 9953056974 šŸ” Delhi escort Service
Hot Sexy call girls in Panjabi Bagh šŸ” 9953056974 šŸ” Delhi escort ServiceHot Sexy call girls in Panjabi Bagh šŸ” 9953056974 šŸ” Delhi escort Service
Hot Sexy call girls in Panjabi Bagh šŸ” 9953056974 šŸ” Delhi escort Service
Ā 
SIEMENS: RAPUNZEL ā€“ A Tale About Knowledge Graph
SIEMENS: RAPUNZEL ā€“ A Tale About Knowledge GraphSIEMENS: RAPUNZEL ā€“ A Tale About Knowledge Graph
SIEMENS: RAPUNZEL ā€“ A Tale About Knowledge Graph
Ā 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
Ā 
Bun (KitWorks Team Study ė…øė³„ė§ˆė£Ø ė°œķ‘œ 2024.4.22)
Bun (KitWorks Team Study ė…øė³„ė§ˆė£Ø ė°œķ‘œ 2024.4.22)Bun (KitWorks Team Study ė…øė³„ė§ˆė£Ø ė°œķ‘œ 2024.4.22)
Bun (KitWorks Team Study ė…øė³„ė§ˆė£Ø ė°œķ‘œ 2024.4.22)
Ā 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
Ā 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
Ā 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
Ā 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Ā 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
Ā 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
Ā 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
Ā 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Ā 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Ā 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
Ā 

Mobile Web on Drupal!

  • 1. The Mobile Web on Drupal! Thursday, January 13, 2011
  • 2. Where are we going today? Mobile Web development theories and philosophies Reality check! Core tenets I like to stick to So, about Drupal...the good and the bad Digging in and putting some pieces together (CODE!) Stuff to read so you can learn more Thursday, January 13, 2011
  • 3. How technical is this going to be? Weā€™ll start high level (everyone) Weā€™ll talk about strategy and device grouping (everyone/solution architects) Weā€™ll talk about Drupalā€™s strengths and weaknesses and 3rd-party stuff. (everyone/somewhat technical) Weā€™ll look at code for a hypothetical module and work with Drupal hooks and whatnot. (devs/code) Weā€™ll talk about mobile theming strategy. (designers) Iā€™ll recommend some books, blogs and mailing lists. (everyone) Thursday, January 13, 2011
  • 4. Nope. This topic is huge. We wonā€™t have time to talk about: Detailed (HTML/CSS) markup for mobile devices. The ļ¬ner points of device-speciļ¬c support for technologies (CSS/JS/HTML5/whatever). Design and UX best practices. Testing. All of these areas are incredibly important, though! Thursday, January 13, 2011
  • 5. By The Way This presentation is based on Drupal 6 My current feeling about D7* * Sorry Thursday, January 13, 2011
  • 6. Leading Philosophies of Mobile Web Development Thursday, January 13, 2011
  • 8. One Web means making, as far as is reasonable, the same information and services available to users irrespective of the device they are using. However, it does not mean that exactly the same information is available in exactly the same representation across all devices. The context of mobile use, device capability variations, bandwidth issues and mobile network capabilities all affect the representation... ...it is considered best practice to provide as reasonable experience as is possible given device limitations and not to exclude access from any particular class of device, except where this is necessary because of device limitations.... Errr... Thursday, January 13, 2011
  • 9. That means... Separate mobile site or domain (e.g. m.mysite.com) is discouraged. All users should get, for the most part, the same text, features, markup, images, functionality, etc. (within reason, which you get to determine). Develop once (I do like this part). Thursday, January 13, 2011
  • 10. Responsive Web Design (RWD) Thursday, January 13, 2011
  • 11. RWD Using sophisticated markup and CSS techniques to make the ā€œOne Webā€ ideal more attainable. Using CSS Media Queries to adapt content, allowing for ā€œOne Webā€ success Fluid grid designs For the most part, send the same HTML markup and media (e.g. images) to everyone http://www.alistapart.com/articles/responsive-web- design/ Thursday, January 13, 2011
  • 12. I am a CSS Media Query: <link rel="stylesheet" type="text/css" media="screen and (max-device-width: 480px)" href="shetland.css" /> Thursday, January 13, 2011
  • 14. Progressive Enhancement Not just a mobile concern Luke Wā€™s ā€œMobile Firstā€ credo is in the same family Design your baseline site for mobile, then go from there http://www.lukew.com/ff/entry.asp?933 Thursday, January 13, 2011
  • 15. Server-Side Device Detection and Adaptation Thursday, January 13, 2011
  • 16. Who goes there? Thursday, January 13, 2011
  • 17. Server-Side Device Detection Based on using User Agent strings to make an educated guess at what a device is and what capabilities it has Several device libraries support this. Two of the best known are: WURFL DeviceAtlas Thursday, January 13, 2011
  • 18. WURFL http://wurļ¬‚.sourceforge.net/ Maintained/moderated by Luca Passani. Exhaustive details about mobile device and client capabilities based on User Agent. Contributors have created APIs in several languages. Free and open source. Thursday, January 13, 2011
  • 19. Letā€™s Look at some WURFL Capabilities Tera-WURFL Explorer http://www.tera-wurļ¬‚.com/explore/ Thursday, January 13, 2011
  • 20. DeviceAtlas Licenses run from $99/yr (per server) to ... well, more. You get guaranteed updates. API is PHP, Java, .Net Analytics as well. Web site is free and a useful reference for looking up devices right quick. http://deviceatlas.com Thursday, January 13, 2011
  • 22. Whereas server-side detection asks ā€œWho goes there?,ā€ client-side adaptation allows you to say things like: Thursday, January 13, 2011
  • 23. Oh, yeah? prove it. Thursday, January 13, 2011
  • 24. Client-Side Adaptation Determining real client capabilities a la Modernizr Using CSS Media queries Taking delivered markup the ļ¬nal mile Ensures that the client can walk the walk Thursday, January 13, 2011
  • 25. Modernizr (A Quick Aside) Runs tests on the client Adds CSS classes to the <html> element based on what it discovers You, noble developer/themer, can: Write your CSS accordingly Use JavaScript to extend your stuff Based on what the browser can actually do http://www.modernizr.com Thursday, January 13, 2011
  • 26. So, that all sounds lovely and clean and unicorn-shaped. Thursday, January 13, 2011
  • 29. ā€œOne Webā€ is vague Dear Puny Human, Make one Web site such that itā€™s, like, the same on all devices, except, well, make sure that it is appropriately different on some devices. Donā€™t exclude anyone, except when ā€œdevice limitationsā€ force you to. Iā€™ll leave deciding what a device limitation is as an exercise for the reader. Love, The W3C http://www.w3.org/TR/mobile-bp/#OneWeb Thursday, January 13, 2011
  • 30. RWD has performance and bandwidth implications Image resizing on devices can be inefļ¬cient and uses bandwidth you might not need to use. CSS media query support is fragmented and only on modern devices. For the most part, images hidden in CSS still get downloaded. Weā€™re sending the device bytes that it is not going to use. http://www.cloudfour.com/css-media-query-for-mobile- is-fools-gold/ Thursday, January 13, 2011
  • 31. Shoving a 153,600-pixel image at a phone that only has about 16,000 pixels of real estate to work with is like giving 4-by-8- foot sheets of plywood to a kid who wants to build a miniature birdhouse. Even if wood is cheap, it tastelessly wastes a lot of trees... ā€”Lyza Gardner (Me) Adventures on the Mobile Web Frontier, Nov. 4, 2010 * http://www.cloudfour.com/adventures-on-the-mobile-web-frontier-wrangling- drupal-third-party-apis-and-server-oomph-into-an-enterprise-class- experience/ * Sorry about that URL; my bad Thursday, January 13, 2011
  • 32. Server-side device detection via UA is not infallible... Who goes there? Hello, Web Server, I am a sheep! Thursday, January 13, 2011
  • 33. Who goes there? Web Server! I am also a sheep!* *Not really a sheep. Thursday, January 13, 2011
  • 34. Client-side enhancement can be pretty tricky if your userā€™s device isnā€™t up to it ā€œHi, Iā€™m BlackBerry version 4.5. Youā€™d be surprised at how many people at big companies still use me and love me. You cannot manipulate my DOM and my JavaScript performance is very sad. Sorry.ā€ Thursday, January 13, 2011
  • 36. Duct Tape Programming ā€œDuct tape programmers are pragmatic... ā€œA 50%-good solution that people actually have solves more problems and survives longer than a 99% solution that nobody has because itā€™s in your lab where youā€™re endlessly polishing the damn thing. ā€œShipping is a feature. A really important feature. Your product must have it.ā€ ā€”Joel Spolsky The Duct Tape Programmer, Sept. 23, 2009 Joel on Software http://www.joelonsoftware.com/items/2009/09/23.html Thursday, January 13, 2011
  • 38. So, how do we keep our nose clean in this tragicomical environment? Staying True to a Couple of Tenets... Thursday, January 13, 2011
  • 39. 1. Donā€™t send bits to a device that it wonā€™t use Thursday, January 13, 2011
  • 40. bits == dollars bits == waiting bits ~= processing Thursday, January 13, 2011
  • 41. 2. The client is always right* * This one gets me in a bit of trouble Thursday, January 13, 2011
  • 42. Remember how I said that User Agents arenā€™t always 100% honest and forthcoming? Or, at least, sane? Thursday, January 13, 2011
  • 43. Whose User Agent is this? Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; en-us) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Safari/530.17 Thursday, January 13, 2011
  • 44. A Sane Person would guess... Desktop Safari And thatā€™s what WURFL will tell you, too Thursday, January 13, 2011
  • 45. But Itā€™s Skyļ¬re for Android. Thursday, January 13, 2011
  • 46. ā€œLoad web pages as either traditional Android user agent or as a desktop browser. The desktop option gives you more ļ¬‚exibility in accessing web sites and allows discovery of video content that might not be visible on the mobile site.ā€ Laughing all the way to the Bank or whatever, Love, Skyļ¬re Skyļ¬re Web Site http://www.skyļ¬re.com/product/android Thursday, January 13, 2011
  • 47. What do we do?! So, the User Agent for Skyļ¬reā€™s desktop mode is cruel and manipulative. What should we do? Me: Give them the desktop experience. They asked for it. If it sucks enough for enough people, Skyļ¬re will hopefully adapt. This is not a universally-embraced opinion, to say the least. And leaves some folks out in the cold. What do you think? Thursday, January 13, 2011
  • 49. Letā€™s make something that works Thursday, January 13, 2011
  • 50. Device Classes A device class is a collection of attributes and capabilities that deļ¬ne a group of mobile devices. There are no industry-standard device classes, but there are some rules of thumb and generalizations that can help you deļ¬ne your device classes. We usually end up with about 3-5 major device classes per project. Thursday, January 13, 2011
  • 51. Device Classes: Why? Keeps you sane. Helps you focus on your target users. Gives you a context to think within when designing UX and IA for your site or app. Roughly, device class == context Thursday, January 13, 2011
  • 52. Some Advice about Device Classes Donā€™t get too distracted by pixel dimensions. Choose your ā€œbaselineā€ class carefully. Whoā€™s your main audience? Youā€™ve heard this nag before,: donā€™t assume everyone has an iPhone or Android. device class != theme/layout Thursday, January 13, 2011
  • 53. Example Device Classes Device Class Criteria Notes ā€¢ Webkit-based browser ā€¢ Minimum resolution 320x480 ā€œMobile Webkitā€ ā€¢ Sophisticated CSS/JS/XHR ā€œThere is no Webkit on mobileā€. ā€”Peter-Paul Koch, QuirksMode support ā€¢ Resolution 240-320px ā€¢ Robust XHTML support Donā€™t neglect this class! Smartphones ā€¢ Reasonable AJAX and JS BB5, Win 6.x, etc. ā€¢ Quite possibly less awesome CSS ā€¢ Resolution 128-240px ā€¢ HTML support a.k.a. feature Dumbphones ā€¢ Cookie/HTTPs support ā€¢ Limited CSS support phones Thursday, January 13, 2011
  • 54. And Then you draw the line somewhere e.g. ā€œFor a mobile device to be successful using this Web-based application, it must support images, cookies and HTTPs, and have a resolution of at least 128px.ā€ Thursday, January 13, 2011
  • 55. And the rest, you gently kick to the curb. Gently. Thursday, January 13, 2011
  • 56. OK, Here comes the Drupal part... Thursday, January 13, 2011
  • 57. First, some good news Thursday, January 13, 2011
  • 58. Drupal is great because: We can easily extend it by writing modules or using those that others have kindly already written The theming stack and hook architecture is ļ¬‚exible enough that we can override almost anything we need to Sub-theming gives us even more power here There are already some third-party modules that can help us Your site may already be running on it. Thursday, January 13, 2011
  • 59. Now some bad news... Thursday, January 13, 2011
  • 60. Drupal makes kittens cry because: Drupal 6 doesnā€™t have a deļ¬nitive hook for managing CSS and JS Theme inheritance can only go so far WYSIWTF There is no simple, 3rd-party solution you can just drop into place. I bet there will be in the future. But. Thursday, January 13, 2011
  • 61. WYSIWTF How the heck can your siteā€™s editors create content that will look right on all devices? CKEditor canā€™t save your butt here Donā€™t blame Drupal per se: No one has nailed this one I donā€™t have a good answer for you here...yet Thursday, January 13, 2011
  • 62. Everything you learn today is obsolete tomorrow Case in point: This just in! http://drupal.org/project/tinysrc Thursday, January 13, 2011
  • 64. mobile tools A lot of stuff in this module, and it can integrate with WURFL or BrowserCap. These are your device classes. Take ā€˜em or leave ā€˜em. function mobile_tools_device_groups() { Ā  return array('iphone', 'ipod', 'android', 'opera mini', 'blackberry'); } ā€œThe Mobile Tools module currently doesn't provide information on the device characteristics such as screen size, browser capabilities, javascript support, etc ...ā€ (from the project page) Generally, I ļ¬nd that I want a bit more control than this module gives me, but it could serve as a great starting point. Thursday, January 13, 2011
  • 65. wurļ¬‚ Uses PHP API Recent rewrite...not backwards compatible so much. UGH. Doesnā€™t expose everything from the PHP API, but does encapsulate some. Multiple sites? Youā€™ll be replicating the WURFL data. Install process is a bit painful. But, overall, a good place to start, and weā€™ll be using it in our examples tonight. Thursday, January 13, 2011
  • 66. Putting it Together Thursday, January 13, 2011
  • 67. Code! Alert! Thursday, January 13, 2011
  • 68. We are going to... Use and depend on the wurļ¬‚ module Create our own module Detect Devices Switch Themes Create and implement a Device Class Deļ¬nition hook Deļ¬ne some device classes Test devices against deļ¬ned device classes Create some mobile themes Add some useful code to our themes to strip certain JS and CSS Thursday, January 13, 2011
  • 69. Disclaimer! OMG! Donā€™t take this code too literally. Itā€™s meant as: A. A stepping-off point and B. Pseudo-code It is based on real code (which has been tested) but has not been tested in its current form. You donā€™t have to implement it this way! These are just rough ideas for yah. Thursday, January 13, 2011
  • 70. Our Module: mobile_web (structure) Thursday, January 13, 2011
  • 71. First Pass at the hook_init() Thursday, January 13, 2011
  • 72. Create a Hook for Device Classes Thursday, January 13, 2011
  • 73. Device Class Deļ¬nitions This can be read: ((is_wireless_device == TRUE) && (ajax_xhr_type != ā€˜noneā€™) && (mobile_browser === ā€˜Safariā€™ || mobile_browser === ā€˜Android Webkitā€™)) Thursday, January 13, 2011
  • 74. Deļ¬ne some Device Classes In the interest of brevity, only two device classes here and ā€œWebkit on Mobileā€ is over-simplified. Thursday, January 13, 2011
  • 75. Second Pass at hook_init() Thursday, January 13, 2011
  • 76. Matching Device Classes Get the code for mobile_web_device_match(), if you want it, at http://pastebin.com/jtufBq38 Returns TRUE if the current set of device class capabilities match the current userā€™s device Thursday, January 13, 2011
  • 78. Creating some Themes Consider your DOCTYPE Familiarize yourself with whatā€™s supported in XHTML- MP Drupal-speciļ¬c gotcha: Youā€™ll need to override theme(ā€˜tableā€™) if you want your code to validate in XHTML-MP 1.2 (<thead> is invalid). You can mostly disregard WML these days. I sub-theme quite a bit (http://drupal.org/node/ 225125) Thursday, January 13, 2011
  • 79. Might I suggest? Iā€™m a big fan of sub-themes. Thursday, January 13, 2011
  • 80. Another Variant For hybrid desktop/mobile sites. I also advise using the admin_theme module such that the admin interface stays sane. Thursday, January 13, 2011
  • 81. Donā€™t Panic! Youā€™re not going to have to implement full-ļ¬‚edged themes for all of your devices! Our device class themes usually contain: Additional CSS for that device class (in addition to default mobile or overrides) Device-class-speciļ¬c JS Overrides for templates on an as-needed basis. Thursday, January 13, 2011
  • 82. My CSS and JS are Out of Control! In D6, theme has ļ¬nal say-so of what JS and CSS get delivered First call to drupal_add_js() always adds jQuery and drupal.js Iā€™ll show you how to get around this, but it is ugly A brief D7 interlude: This is remedied in D7 with two new alter hooks for CSS and JS Thursday, January 13, 2011
  • 83. Control your JS and CSS Youā€™ll have to do this in a themeā€™s template.php ļ¬le. If you have themes subclassed from a single mobile theme, you can put this in one place (the top-level mobile theme). I do it from a hook_preprocess_page(&$vars) implementation. Thursday, January 13, 2011
  • 84. Stripping JS and CSS The premise of the code is: Declare some JS (or CSS) that is allowed for the mobile theme at hand. Iterate through the JS in the ā€˜scriptsā€™ var (all current JS/CSS set up to be in the page) and make sure each entry is ā€œallowed.ā€ Remove those that are not. For JS, if only drupal.js and jQuery.js are left at the end, remove those, too. Re-set the ā€˜scriptsā€™ var by calling drupal_get_js() with the updated array of JS (or the same concept with CSS). Thursday, January 13, 2011
  • 85. Simplest Way to strip Extra JS... The same approach works for CSS (the ā€˜stylesā€™ variable). Thursday, January 13, 2011
  • 86. Sorry. That was a bit fugly. Thursday, January 13, 2011
  • 88. Where to from here? Use the device class to help determine how theme functions behave, both on the theme level and module levels. Use the imagecache module to serve appropriately-sized images to different device classes (or maybe tinysrc!). Expand device class deļ¬nitions to add any sort of arbitrary data youā€™d like. Keep a WURFL object (or other data structure representing the WURFL attributes) available; you can ask about a deviceā€™s speciļ¬c capabilities anywhere in your code. Thursday, January 13, 2011
  • 89. Exercises for the Reader Some things weā€™ve done to make this stuff cooler: Build an admin interface for managing allowed CSS/ JS and other goodies. Build logging to capture User Agents and their device class results (might not want to leave this on in production!) Consider running a Tera-WURFL setup. Thursday, January 13, 2011
  • 90. Where are things heading? More client-based stuff as mobile browsers get beeļ¬er More 3rd-party Drupal support This era is kind of like the JavaScript browser insanity of the late 90s Thursday, January 13, 2011
  • 91. Resources and Further Reading Thursday, January 13, 2011
  • 92. Read these books and blogs Programming the Mobile Web Maximiliano Firtman (Oā€™Reilly) Beginning Smartphone Web Development Gail Rahn Frederick/Rajesh Lal (Apress) Because JS is Important for mobile: High Performance JavaScript Nicholas C. Zakas (Oā€™Reilly) JavaScript: The Good Parts Douglas Crockford (Oā€™Reilly) Thursday, January 13, 2011
  • 93. Read these books and blogs QuirksBlog by PPK (Peter-Paul Koch) http://www.quirksmode.org/blog/ Andrea Trasattiā€™s tech notes and more http://blog.trasatti.it/ Communities Dominate Brands (Tomi Ahonen) http://communities-dominate.blogs.com/brands/ Luke Wroblewski aka @lukew http://www.lukew.com/ff/ Thursday, January 13, 2011
  • 94. Super Useful Groups & Mailing Lists mobile-web Yahoo! Group http://tech.groups.yahoo.com/group/mobile-web An active, useful list wmlprogramming Yahoo! Group http://tech.groups.yahoo.com/group/wmlprogramming Despite the misleading name, this mailing list focuses on WURFL. Expect a rollicking time. Mobile Portland http://mobileportland.com/ http://groups.google.com/group/mobile-portland Meets the fourth Monday of each month Thursday, January 13, 2011
  • 95. Who Am I? Lyza Danger Gardner co-founder, mobile Web developer type of person Cloud Four http://www.cloudfour.com http://www.lyza.com @lyzadanger Thursday, January 13, 2011