SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Tendances

Native Device vs. Mobile Web Applications
Native Device vs. Mobile Web ApplicationsNative Device vs. Mobile Web Applications
Native Device vs. Mobile Web ApplicationsTim Wright
 
Eye candy for your iPhone
Eye candy for your iPhoneEye candy for your iPhone
Eye candy for your iPhoneBrian Shim
 
Creating a Balanced UX Workflow
Creating a Balanced UX WorkflowCreating a Balanced UX Workflow
Creating a Balanced UX WorkflowJason Beaird
 
Navigation guidelines on Windows Modern UI
Navigation guidelines on Windows Modern UINavigation guidelines on Windows Modern UI
Navigation guidelines on Windows Modern UIMaria Nasioti
 
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 - ...Sencha
 
Responsive Navigation Patterns, UX and Guidelines
Responsive Navigation Patterns, UX and GuidelinesResponsive Navigation Patterns, UX and Guidelines
Responsive Navigation Patterns, UX and GuidelinesPeter Rozek
 
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 CitySearch Engine Journal
 
Building native apps with web components
Building native apps with web componentsBuilding native apps with web components
Building native apps with web componentsDenis Radin
 
Expertise In Mobile SEO
Expertise In Mobile SEOExpertise In Mobile SEO
Expertise In Mobile SEONimap Infotech
 
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 techniquesFrancisco Ferreira
 
Facebook Timeline - Implications & Strategy
Facebook Timeline - Implications & StrategyFacebook Timeline - Implications & Strategy
Facebook Timeline - Implications & StrategyJoey Barker
 
Mobile JS Frameworks
Mobile JS FrameworksMobile JS Frameworks
Mobile JS FrameworksIbrahim Ersoy
 

Tendances (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
 

Similaire à Building Mobile Websites

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...Conductor
 
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 2014John Shehata
 
The Mobile Development Landscape
The Mobile Development LandscapeThe Mobile Development Landscape
The Mobile Development LandscapeAmbert Ho
 
Responsive Web Design
Responsive Web DesignResponsive Web Design
Responsive Web DesignJulia Vi
 
Breaking The Broken Web
Breaking The Broken WebBreaking The Broken Web
Breaking The Broken WebFITC
 
Multi screen HTML5
Multi screen HTML5Multi screen HTML5
Multi screen HTML5Ron Reiter
 
Responsive Web Design (HeadStart TechTalks)
Responsive Web Design (HeadStart TechTalks)Responsive Web Design (HeadStart TechTalks)
Responsive Web Design (HeadStart TechTalks)Tirthesh Ganatra
 
Great Responsive-ability Web Design
Great Responsive-ability Web DesignGreat Responsive-ability Web Design
Great Responsive-ability Web DesignMike Wilcox
 
Mobile SEO Considerations
Mobile SEO ConsiderationsMobile SEO Considerations
Mobile SEO ConsiderationsReva McPollom
 
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/Jack Zheng
 
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?Henny Swan
 
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 webJenifer Hanen
 
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 UsersBBDO
 
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! #DevConMUAntonio Peric-Mazar
 
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 #BigD12touchtitans
 

Similaire à 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
 

Dernier

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
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
 
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
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard37
 
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
 
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
 
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
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMKumar Satyam
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
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
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)Samir Dash
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 

Dernier (20)

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
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
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
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
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
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
 
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
 
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...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
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, ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 

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