SlideShare uma empresa Scribd logo
1 de 16
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

Mais conteúdo relacionado

Mais procurados

Mais procurados (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
 

Semelhante a 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
 

Semelhante a 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?
 
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
 
Progressive Web Apps are here!
Progressive Web Apps are here!Progressive Web Apps are here!
Progressive Web Apps are here!
 
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
 

Último

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Último (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 

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