SlideShare a Scribd company logo
MEDIA QUERIES, USER-AGENTS, AND USER OPT-IN, OH MY!

BUILDING MOBILE WEBSITES

                   Shoshi Roberts
                     @shoshizilla
WAYS TO BUILD YOUR MOBILE SITE


1) Detect the User-Agent String and redirect to a mobile site

2) Media Queries (aka. Responsive Design)

3) User Opt-in Link
MOBILE WEBSITES VS. APPS:
                      WHY HAVE A MOBILE SITE?


• Mobile   sites get 10% of all web traffic (stats from 2009, it’s higher now)

• 25% of internet users in the US only browse on mobile
 devices (this is low on a global scale, it’s 70% in Egypt)

• 40%   of tweets are sent from mobile devices (both site and app)

• Some   user flows will send you to the mobile site anyhow...
EXAMPLE FROM TWITTER
User gets an email:        User clicks on the link and goes to:
You have a new follower!   mobile.twitter.com/
MOBILE WEBSITES VS. APPS

                   Moral of the story:
Some people will need websites and some will need apps.
                 You usually want both.
              Use your best judgement.
                 We want happy users.

     You’re a good candidate for an app if you need:
        location data, games, offline functionality
USING USER-AGENT STRING
BENEFITS
• Entirely   optimize your site for mobile

• Provide    tailored Content just for mobile users

• Allows     you to build features for specific mobile needs


DRAWBACKS
• Separate     from your desktop site, possible lack of continuity
USING USER-AGENT STRING
APACHE CONFIG (.htaccess)

RewriteEngine On

RewriteCond %{HTTP_USER_AGENT} (OneMobileUserAgent|
  AnotherMobileUserAgent|YouSeeWhereThisGoes...)
RewriteRule ^$ http://mobile.example.com/ [R,L]



FOR RAILS, PYTHON, PERL, ASP, PHP, JS,NGINX...
http://detectmobilebrowsers.com/
USING MEDIA QUERIES
BENEFITS
• Makes your site look great at all screen sizes (desktop/
 tablet/mobile)

• Unified   content across all platforms


DRAWBACKS
• More complicated to have custom content or special
 features on mobile site
USING MEDIA QUERIES
SINGLE CSS FILE
@media screen and (min-device-width: 769px) {
   div.example {
     width: 30%;  /* 3 columns for desktop */
   }
}
@media screen and (min-device-width: 481px) and
                  (max-device-width: 768px) {
  div.example {
     width: 50%;  /* 2 columns for tablets and netbooks */
   }
}
@media screen and (max-device-width: 480px) {
  div.example {
     width: 100%; /* 1 column for mobile */
   }
}
USING MEDIA QUERIES
MULTIPLE CSS FILES (put this HTML in <head>)
<meta name="viewport" content="width=device-width,
      initial-scale=1.0">

<link rel="stylesheet"
      href="styles.css"> <!-- for global styles -->
<link rel="stylesheet"
      media="screen and (min-device-width: 769px)"
      href="desktop.css">
<link rel="stylesheet"
      media="screen and (min-device-width: 481px) and
             (max-device-width: 768px)"
      href="tablet.css">
<link rel="stylesheet"
      media="screen and (max-device-width: 480px)"
      href="mobile.css">
USING MEDIA QUERIES




       DESKTOP
USING MEDIA QUERIES




  TABLET      MOBILE
USING USER OPT-IN
BENEFITS
• User   sees the desktop site they know and love

• User   gets to choose which version to see

DRAWBACKS
• User may leave because of a poor experience before the
 click on the “mobile version” or even “download app” link
USING USER OPT-IN
MAKE A LINK!
<a href=”http://mobile.example.com/”>Mobile Site</a>

<a href=”http://example.com/mobile/”>Mobile Site</a>



MAKE IT FANCY
• UseJS or another framework to detect the user-agent
 and provide a banner at the top of the page

• NOTE:This can be effective if used the opposite way:
 “Want to see the desktop version? Click here.”
WRAPPING IT UP

• Responsive   Design is easy to incorporate now

• Usemobile site redirects (with the User-Agent string) when
 you want to use different functionality and design

• Make   it easy for the user no matter how they visit your site

• Consider   your user’s desires, and use your best judgement
THANKS
        AND HAPPY HACKING!




  @shoshizilla for @ladieswhocode
Special Thanks to @mintdigital for hosting

More Related Content

What's hot

What's hot (16)

Native Device vs. Mobile Web Applications
Native Device vs. Mobile Web ApplicationsNative Device vs. Mobile Web Applications
Native Device vs. Mobile Web Applications
 
Eye candy for your iPhone
Eye candy for your iPhoneEye candy for your iPhone
Eye candy for your iPhone
 
Creating a Balanced UX Workflow
Creating a Balanced UX WorkflowCreating a Balanced UX Workflow
Creating a Balanced UX Workflow
 
Navigation guidelines on Windows Modern UI
Navigation guidelines on Windows Modern UINavigation guidelines on Windows Modern UI
Navigation guidelines on Windows Modern UI
 
SenchaCon 2016: Accessibility, Teamwork & Ext JS: A Customer Success Story - ...
SenchaCon 2016: Accessibility, Teamwork & Ext JS: A Customer Success Story - ...SenchaCon 2016: Accessibility, Teamwork & Ext JS: A Customer Success Story - ...
SenchaCon 2016: Accessibility, Teamwork & Ext JS: A Customer Success Story - ...
 
Responsive Navigation Patterns, UX and Guidelines
Responsive Navigation Patterns, UX and GuidelinesResponsive Navigation Patterns, UX and Guidelines
Responsive Navigation Patterns, UX and Guidelines
 
Big Brands, Mobile SEO and You by John Shehata - #SEJSummit New York City
Big Brands, Mobile SEO and You by John Shehata - #SEJSummit New York CityBig Brands, Mobile SEO and You by John Shehata - #SEJSummit New York City
Big Brands, Mobile SEO and You by John Shehata - #SEJSummit New York City
 
Mobile site options
Mobile site optionsMobile site options
Mobile site options
 
Building native apps with web components
Building native apps with web componentsBuilding native apps with web components
Building native apps with web components
 
Responsive Design
Responsive DesignResponsive Design
Responsive Design
 
Expertise In Mobile SEO
Expertise In Mobile SEOExpertise In Mobile SEO
Expertise In Mobile SEO
 
Sc open all hours final
Sc open all hours finalSc open all hours final
Sc open all hours final
 
Mobile Web - Merging responsive and adaptive techniques
Mobile Web - Merging responsive and adaptive techniquesMobile Web - Merging responsive and adaptive techniques
Mobile Web - Merging responsive and adaptive techniques
 
Facebook Timeline - Implications & Strategy
Facebook Timeline - Implications & StrategyFacebook Timeline - Implications & Strategy
Facebook Timeline - Implications & Strategy
 
Mobile Optimization
Mobile OptimizationMobile Optimization
Mobile Optimization
 
Mobile JS Frameworks
Mobile JS FrameworksMobile JS Frameworks
Mobile JS Frameworks
 

Similar to Building Mobile Websites

Responsive UX - One size fits all @BigDesign conference #BigD12
Responsive UX - One size fits all   @BigDesign conference #BigD12Responsive UX - One size fits all   @BigDesign conference #BigD12
Responsive UX - One size fits all @BigDesign conference #BigD12
touchtitans
 

Similar to Building Mobile Websites (20)

Best Practices for Mobile Web Design
Best Practices for Mobile Web DesignBest Practices for Mobile Web Design
Best Practices for Mobile Web Design
 
Why Mobile, Why Now? | John Shehata – Executive Director of Search & Social M...
Why Mobile, Why Now? | John Shehata – Executive Director of Search & Social M...Why Mobile, Why Now? | John Shehata – Executive Director of Search & Social M...
Why Mobile, Why Now? | John Shehata – Executive Director of Search & Social M...
 
Advanced Mobile SEO - John Shehata - C3 2014
Advanced Mobile SEO - John Shehata - C3 2014Advanced Mobile SEO - John Shehata - C3 2014
Advanced Mobile SEO - John Shehata - C3 2014
 
The Mobile Development Landscape
The Mobile Development LandscapeThe Mobile Development Landscape
The Mobile Development Landscape
 
Responsive Web Design
Responsive Web DesignResponsive Web Design
Responsive Web Design
 
Breaking The Broken Web
Breaking The Broken WebBreaking The Broken Web
Breaking The Broken Web
 
Multi screen HTML5
Multi screen HTML5Multi screen HTML5
Multi screen HTML5
 
Responsive Web Design (HeadStart TechTalks)
Responsive Web Design (HeadStart TechTalks)Responsive Web Design (HeadStart TechTalks)
Responsive Web Design (HeadStart TechTalks)
 
Great Responsive-ability Web Design
Great Responsive-ability Web DesignGreat Responsive-ability Web Design
Great Responsive-ability Web Design
 
Mobile SEO Considerations
Mobile SEO ConsiderationsMobile SEO Considerations
Mobile SEO Considerations
 
Mobile Web Overview https://www.edocr.com/v/k52p5vj4/
Mobile Web Overview https://www.edocr.com/v/k52p5vj4/Mobile Web Overview https://www.edocr.com/v/k52p5vj4/
Mobile Web Overview https://www.edocr.com/v/k52p5vj4/
 
Mobile web development
Mobile web development Mobile web development
Mobile web development
 
Is the mobile web enabled or disabled by design?
Is the mobile web enabled or disabled by design?Is the mobile web enabled or disabled by design?
Is the mobile web enabled or disabled by design?
 
Progressive Web Apps are here!
Progressive Web Apps are here!Progressive Web Apps are here!
Progressive Web Apps are here!
 
20181023 progressive web_apps_are_here_sfcampua
20181023 progressive web_apps_are_here_sfcampua20181023 progressive web_apps_are_here_sfcampua
20181023 progressive web_apps_are_here_sfcampua
 
Mobilism 2011: How to put the mobile in the mobile web
Mobilism 2011: How to put the mobile in the mobile webMobilism 2011: How to put the mobile in the mobile web
Mobilism 2011: How to put the mobile in the mobile web
 
Responsive & Adaptive Design: Delivering Websites That Delight Your Users
Responsive & Adaptive Design: Delivering Websites That Delight Your UsersResponsive & Adaptive Design: Delivering Websites That Delight Your Users
Responsive & Adaptive Design: Delivering Websites That Delight Your Users
 
Simple mobile Websites
Simple mobile WebsitesSimple mobile Websites
Simple mobile Websites
 
A year with progressive web apps! #DevConMU
A year with progressive web apps! #DevConMUA year with progressive web apps! #DevConMU
A year with progressive web apps! #DevConMU
 
Responsive UX - One size fits all @BigDesign conference #BigD12
Responsive UX - One size fits all   @BigDesign conference #BigD12Responsive UX - One size fits all   @BigDesign conference #BigD12
Responsive UX - One size fits all @BigDesign conference #BigD12
 

Recently uploaded

Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 

Recently uploaded (20)

Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptxWSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024
 
In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT Professionals
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 

Building Mobile Websites

  • 1. MEDIA QUERIES, USER-AGENTS, AND USER OPT-IN, OH MY! BUILDING MOBILE WEBSITES Shoshi Roberts @shoshizilla
  • 2. WAYS TO BUILD YOUR MOBILE SITE 1) Detect the User-Agent String and redirect to a mobile site 2) Media Queries (aka. Responsive Design) 3) User Opt-in Link
  • 3. MOBILE WEBSITES VS. APPS: WHY HAVE A MOBILE SITE? • Mobile sites get 10% of all web traffic (stats from 2009, it’s higher now) • 25% of internet users in the US only browse on mobile devices (this is low on a global scale, it’s 70% in Egypt) • 40% of tweets are sent from mobile devices (both site and app) • Some user flows will send you to the mobile site anyhow...
  • 4. EXAMPLE FROM TWITTER User gets an email: User clicks on the link and goes to: You have a new follower! mobile.twitter.com/
  • 5. MOBILE WEBSITES VS. APPS Moral of the story: Some people will need websites and some will need apps. You usually want both. Use your best judgement. We want happy users. You’re a good candidate for an app if you need: location data, games, offline functionality
  • 6. USING USER-AGENT STRING BENEFITS • Entirely optimize your site for mobile • Provide tailored Content just for mobile users • Allows you to build features for specific mobile needs DRAWBACKS • Separate from your desktop site, possible lack of continuity
  • 7. USING USER-AGENT STRING APACHE CONFIG (.htaccess) RewriteEngine On RewriteCond %{HTTP_USER_AGENT} (OneMobileUserAgent| AnotherMobileUserAgent|YouSeeWhereThisGoes...) RewriteRule ^$ http://mobile.example.com/ [R,L] FOR RAILS, PYTHON, PERL, ASP, PHP, JS,NGINX... http://detectmobilebrowsers.com/
  • 8. USING MEDIA QUERIES BENEFITS • Makes your site look great at all screen sizes (desktop/ tablet/mobile) • Unified content across all platforms DRAWBACKS • More complicated to have custom content or special features on mobile site
  • 9. USING MEDIA QUERIES SINGLE CSS FILE @media screen and (min-device-width: 769px) { div.example { width: 30%; /* 3 columns for desktop */ } } @media screen and (min-device-width: 481px) and (max-device-width: 768px) { div.example { width: 50%; /* 2 columns for tablets and netbooks */ } } @media screen and (max-device-width: 480px) { div.example { width: 100%; /* 1 column for mobile */ } }
  • 10. USING MEDIA QUERIES MULTIPLE CSS FILES (put this HTML in <head>) <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="styles.css"> <!-- for global styles --> <link rel="stylesheet" media="screen and (min-device-width: 769px)" href="desktop.css"> <link rel="stylesheet" media="screen and (min-device-width: 481px) and (max-device-width: 768px)" href="tablet.css"> <link rel="stylesheet" media="screen and (max-device-width: 480px)" href="mobile.css">
  • 12. USING MEDIA QUERIES TABLET MOBILE
  • 13. USING USER OPT-IN BENEFITS • User sees the desktop site they know and love • User gets to choose which version to see DRAWBACKS • User may leave because of a poor experience before the click on the “mobile version” or even “download app” link
  • 14. USING USER OPT-IN MAKE A LINK! <a href=”http://mobile.example.com/”>Mobile Site</a> <a href=”http://example.com/mobile/”>Mobile Site</a> MAKE IT FANCY • UseJS or another framework to detect the user-agent and provide a banner at the top of the page • NOTE:This can be effective if used the opposite way: “Want to see the desktop version? Click here.”
  • 15. WRAPPING IT UP • Responsive Design is easy to incorporate now • Usemobile site redirects (with the User-Agent string) when you want to use different functionality and design • Make it easy for the user no matter how they visit your site • Consider your user’s desires, and use your best judgement
  • 16. THANKS AND HAPPY HACKING! @shoshizilla for @ladieswhocode Special Thanks to @mintdigital for hosting