SlideShare a Scribd company logo
1 of 69
Download to read offline
Mobile Web Application
⽢甘苦談
othree @ MOPCON 2013
me
• @othree	

• MozTW member	

• PhD Candidate of civil engineering	

• F2E at HTC	

• https://blog.othree.net/
• Front End related	

• Experience sharing	

• No code listing
Why Mobile

• We are HTC....
Mozilla Summit 2013
Mozilla Summit 2013
PM Says

“We are going to support mobile browsers”
What We Thought
• Web Standards rule the web	

• Not big problem
Reality
• Browser have bugs	

• Standard implementation not the same	

• Ambiguous standards	

• Hard to debug on some browser	

• Any issue might be new, not like IE
Reality
• Browser have bugs	

• Standard implementation not the same	

Survey
• Ambiguous standards	

• Hard to debug on some browser	

• Any issue might be new, not like IE
What browser you use
on smartphone?
What browser youbrowser by
b) You install use
yourself
on smartphone?

a) Default browser from
your phone
Android Browser
Android Browser
• No updates anymore	

• Google use Chrome as new default	

• Still exists: HTC, Samsung Galaxy S3
Mozilla Summit 2013
• Have bugs, issues
S4 Chrome?
S4 Chrome?
Suggestion to Users

• Use Chrome or Firefox or …
So...
Issues
So...
Issues
• No repaint	

• Ghost Click	

• Toggle location bar will not trigger resize	

• preventDefault not work on touch event	

• HTML5 Video
Repaint
• To save power, browser will reduce repaint	

• It predicts best timing for repaint, what to
repaint	


• Prediction might fail
If Not Repaint

• Things will disappear, in wrong position...etc
Force Repaint
• Access some attribute related to layout	

• ex: offsetHeight
Ghost Click
• Mobile device don’t have real ‘click’ event	

• Simulate ‘click’ using touch events	

• ‘click’ has 300ms delay after ‘touchend’

Avoid Lag
• Use ‘touchend’	

• tap.js


https://github.com/alexgibson/tap.js	


• fastbutton


https://developers.google.com/mobile/
articles/fast_buttons
But..
• Android Browser	

• Trigger simulated click on wrong element
Demo
Location Bar
• 3 states in Android Browser	

• show	

• hide	

• pinned
Location Bar
• 3 states in Android Browser	

• show	

• hide	

• pinned
What’s the Deal
• Window size changes	

• Trigger ‘resize’ event?	

• Android 2:Yes	

• Android 3: No
http://www.quirksmode.org/dom/events/resize_mobile.html
Fix
• Time Interval to check window size change	

• 200ms interval will cause video not play	

• Manuel trigger resize handler when window
size might change
preventDefault
• Can used to prevent user scroll web page	

• Not work on HTC browser	

• Not a bug, its spec...
HTML5 Video
• Loop not work	

• Play event not reliable	

• Duration update issue	

• iPhone, iPod have different implementation
Loop
• Video loop not work on all mobile browser	

• But you can call `play()` on ‘ended’ event
Video Bugs
• ‘play’, ‘playing’ event not reliable	

• Duration have default value	

• Won't stop when buffer ready even if
`pause()` were called
MOPCON 2013
pause() not work
play

playing

download buffer

buffer ready, play

play()

pause()
RobustVideo
• A video wrapper to fix issues above	

• https://github.com/othree/robust-video
iPhone

• Open native player to play HTML5 video
iPhone

• Open native player to play HTML5 video
Limitation
• Video needs visible to be able to play	

• Poster will not used to render in web page	

• No video event is available
Limitation
• Video needs visible to be able to play	

• Poster will not used to render in web page	

• No video event is available
Tip
• Video element outside of window	

• Tap img(poster) to trigger `video.play()`
Tip
<video>

<img>

• Video element outside of window	

• Tap img(poster) to trigger `video.play()`
呼...
Next Time PM Says

“We are going to support mobile browsers”
We Say

“Well, it takes x times longer to do it.”
We Say
Mobile Debugging

“Well, it takes x times longer to do it.”
How to
Browsers
• Safari	

• Chrome	

• Firefox/Opera	

• Android Browser
Safari
• Enable Debug	

• Connect iDevice to your Mac	

• Open Safari

https://developer.apple.com/library/ios/documentation/AppleApplications/Reference/SafariWebContent/DebuggingSafarioniPhoneContent/DebuggingSafarioniPhoneContent.html
Chrome
• Install the ADB Chrome extension	

• Install driver of your device	

• Enable Debug	

• Connect device to PC/Mac
https://developers.google.com/chrome-developer-tools/docs/remote-debugging
Firefox

• https://hacks.mozilla.org/2012/08/remotedebugging-on-firefox-for-android/
Android Browser
• Weinre
http://people.apache.org/~pmuellr/weinre/
docs/latest/

Q

Demo
Thanks

More Related Content

What's hot

What's hot (20)

Getting Hooked on Twitch’s Webhooks - TwitchCon Developer Day 2017
Getting Hooked on Twitch’s Webhooks - TwitchCon Developer Day 2017Getting Hooked on Twitch’s Webhooks - TwitchCon Developer Day 2017
Getting Hooked on Twitch’s Webhooks - TwitchCon Developer Day 2017
 
2017 stuysplash-build-tools
2017 stuysplash-build-tools2017 stuysplash-build-tools
2017 stuysplash-build-tools
 
Git and the inQbation Experience
Git and the inQbation ExperienceGit and the inQbation Experience
Git and the inQbation Experience
 
Flutter For Web: An Intro
Flutter For Web: An IntroFlutter For Web: An Intro
Flutter For Web: An Intro
 
WordPress Developer tools
WordPress Developer toolsWordPress Developer tools
WordPress Developer tools
 
Attack of the BEAST
Attack of the BEASTAttack of the BEAST
Attack of the BEAST
 
Strategies for securing your banks & enterprises (from someone who robs bank...
 Strategies for securing your banks & enterprises (from someone who robs bank... Strategies for securing your banks & enterprises (from someone who robs bank...
Strategies for securing your banks & enterprises (from someone who robs bank...
 
Enterprise PHP (Zend UK Business Conference)
Enterprise PHP (Zend UK Business Conference)Enterprise PHP (Zend UK Business Conference)
Enterprise PHP (Zend UK Business Conference)
 
Paul Campbell — A Modern Approach to Third-Party Embedded Widgets (Turing Fes...
Paul Campbell — A Modern Approach to Third-Party Embedded Widgets (Turing Fes...Paul Campbell — A Modern Approach to Third-Party Embedded Widgets (Turing Fes...
Paul Campbell — A Modern Approach to Third-Party Embedded Widgets (Turing Fes...
 
What Visual Studio Code can do for Java Development
What Visual Studio Code can do for Java DevelopmentWhat Visual Studio Code can do for Java Development
What Visual Studio Code can do for Java Development
 
jQueryUI and HTML5 Video Play Nice
jQueryUI and HTML5 Video Play NicejQueryUI and HTML5 Video Play Nice
jQueryUI and HTML5 Video Play Nice
 
WordPress 4.4 and Beyond
WordPress 4.4 and BeyondWordPress 4.4 and Beyond
WordPress 4.4 and Beyond
 
(Responsive) Video
(Responsive) Video(Responsive) Video
(Responsive) Video
 
DockerCon'15: Shipping Containers to Enterprise Customers
DockerCon'15: Shipping Containers to Enterprise CustomersDockerCon'15: Shipping Containers to Enterprise Customers
DockerCon'15: Shipping Containers to Enterprise Customers
 
JavaScript and Internet Controlled Hardware Prototyping
JavaScript and Internet Controlled Hardware PrototypingJavaScript and Internet Controlled Hardware Prototyping
JavaScript and Internet Controlled Hardware Prototyping
 
IE9 the story so far
IE9 the story so farIE9 the story so far
IE9 the story so far
 
Silverlight vs HTML5 - Lessons learned from the real world...
Silverlight vs HTML5 - Lessons learned from the real world...Silverlight vs HTML5 - Lessons learned from the real world...
Silverlight vs HTML5 - Lessons learned from the real world...
 
Jsday
JsdayJsday
Jsday
 
2015 nouveaux outilsdevweb
2015 nouveaux outilsdevweb2015 nouveaux outilsdevweb
2015 nouveaux outilsdevweb
 
OSDC 2014: Mike Adolphs - How we run Support at GitHub
OSDC 2014: Mike Adolphs - How we run Support at GitHubOSDC 2014: Mike Adolphs - How we run Support at GitHub
OSDC 2014: Mike Adolphs - How we run Support at GitHub
 

Viewers also liked (6)

Functional programming using underscorejs
Functional programming using underscorejsFunctional programming using underscorejs
Functional programming using underscorejs
 
TOSSUG HTML5 讀書會 新標籤與表單
TOSSUG HTML5 讀書會 新標籤與表單TOSSUG HTML5 讀書會 新標籤與表單
TOSSUG HTML5 讀書會 新標籤與表單
 
ECMAScript 6
ECMAScript 6ECMAScript 6
ECMAScript 6
 
this
thisthis
this
 
node ffi
node ffinode ffi
node ffi
 
WAI-ARIA
WAI-ARIAWAI-ARIA
WAI-ARIA
 

Similar to Mobile web application

State of jQuery - AspDotNetStorefront Conference
State of jQuery - AspDotNetStorefront ConferenceState of jQuery - AspDotNetStorefront Conference
State of jQuery - AspDotNetStorefront Conference
dmethvin
 
Phonegap for Engineers
Phonegap for EngineersPhonegap for Engineers
Phonegap for Engineers
Brian LeRoux
 
jQueryTO: State of jQuery March 2013
jQueryTO: State of jQuery March 2013jQueryTO: State of jQuery March 2013
jQueryTO: State of jQuery March 2013
dmethvin
 
Building Mobile Apps with HTML, CSS, and JavaScript
Building Mobile Apps with HTML, CSS, and JavaScriptBuilding Mobile Apps with HTML, CSS, and JavaScript
Building Mobile Apps with HTML, CSS, and JavaScript
Jonathan Stark
 
Cross Platform HTML5 Mobile Development
Cross Platform HTML5 Mobile DevelopmentCross Platform HTML5 Mobile Development
Cross Platform HTML5 Mobile Development
Robert 'Bob' Reyes
 
Mobile Meow at Mobilism
Mobile Meow at MobilismMobile Meow at Mobilism
Mobile Meow at Mobilism
Greg Schechter
 

Similar to Mobile web application (20)

google project glass technology
google project glass technologygoogle project glass technology
google project glass technology
 
State of jQuery - AspDotNetStorefront Conference
State of jQuery - AspDotNetStorefront ConferenceState of jQuery - AspDotNetStorefront Conference
State of jQuery - AspDotNetStorefront Conference
 
State of jQuery June 2013 - Portland
State of jQuery June 2013 - PortlandState of jQuery June 2013 - Portland
State of jQuery June 2013 - Portland
 
Phonegap for Engineers
Phonegap for EngineersPhonegap for Engineers
Phonegap for Engineers
 
SharePoint 2013 Video, Audio and Images and Digital Asset Management with Joe...
SharePoint 2013 Video, Audio and Images and Digital Asset Management with Joe...SharePoint 2013 Video, Audio and Images and Digital Asset Management with Joe...
SharePoint 2013 Video, Audio and Images and Digital Asset Management with Joe...
 
Mocast Postmortem
Mocast PostmortemMocast Postmortem
Mocast Postmortem
 
jQueryTO: State of jQuery March 2013
jQueryTO: State of jQuery March 2013jQueryTO: State of jQuery March 2013
jQueryTO: State of jQuery March 2013
 
Building Mobile Apps with HTML, CSS, and JavaScript
Building Mobile Apps with HTML, CSS, and JavaScriptBuilding Mobile Apps with HTML, CSS, and JavaScript
Building Mobile Apps with HTML, CSS, and JavaScript
 
Where did my modules GO? Building and deploying Go Apps w/ GoCenter & Codefresh
Where did my modules GO? Building and deploying Go Apps w/ GoCenter & CodefreshWhere did my modules GO? Building and deploying Go Apps w/ GoCenter & Codefresh
Where did my modules GO? Building and deploying Go Apps w/ GoCenter & Codefresh
 
Why do mobile projects (still) fail - September 2014 edition
Why do mobile projects (still) fail - September 2014 editionWhy do mobile projects (still) fail - September 2014 edition
Why do mobile projects (still) fail - September 2014 edition
 
Webview: The fifth element
Webview: The fifth elementWebview: The fifth element
Webview: The fifth element
 
"WebView, the fifth element" por @fernando_cejas
"WebView, the fifth element" por @fernando_cejas"WebView, the fifth element" por @fernando_cejas
"WebView, the fifth element" por @fernando_cejas
 
Cross Platform HTML5 Mobile Development
Cross Platform HTML5 Mobile DevelopmentCross Platform HTML5 Mobile Development
Cross Platform HTML5 Mobile Development
 
HTML5 or Android for Mobile Development?
HTML5 or Android for Mobile Development?HTML5 or Android for Mobile Development?
HTML5 or Android for Mobile Development?
 
Architecture app
Architecture appArchitecture app
Architecture app
 
Why Do Mobile Projects Fail?
Why Do Mobile Projects Fail?Why Do Mobile Projects Fail?
Why Do Mobile Projects Fail?
 
Android101 Intro to Android for the enterprise, IdoSphere
Android101 Intro to Android for the enterprise, IdoSphereAndroid101 Intro to Android for the enterprise, IdoSphere
Android101 Intro to Android for the enterprise, IdoSphere
 
Cross Platform HTML5 Mobile Development and the Firefox OS
Cross Platform HTML5 Mobile Development and the Firefox OSCross Platform HTML5 Mobile Development and the Firefox OS
Cross Platform HTML5 Mobile Development and the Firefox OS
 
DevOps goes Mobile - Jax 2014 - Jesper Richter-Reichhelm
DevOps goes Mobile - Jax 2014 - Jesper Richter-ReichhelmDevOps goes Mobile - Jax 2014 - Jesper Richter-Reichhelm
DevOps goes Mobile - Jax 2014 - Jesper Richter-Reichhelm
 
Mobile Meow at Mobilism
Mobile Meow at MobilismMobile Meow at Mobilism
Mobile Meow at Mobilism
 

More from 偉格 高 (7)

Web Component
Web ComponentWeb Component
Web Component
 
Web Developer Tools for ICOS 2013
Web Developer Tools for ICOS 2013Web Developer Tools for ICOS 2013
Web Developer Tools for ICOS 2013
 
Module, AMD, RequireJS
Module, AMD, RequireJSModule, AMD, RequireJS
Module, AMD, RequireJS
 
Javascript essential-pattern
Javascript essential-patternJavascript essential-pattern
Javascript essential-pattern
 
WAI-ARIA is More Than Accessibility
WAI-ARIA is More Than AccessibilityWAI-ARIA is More Than Accessibility
WAI-ARIA is More Than Accessibility
 
Html5 New Features
Html5 New FeaturesHtml5 New Features
Html5 New Features
 
Base2
Base2Base2
Base2
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
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
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
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
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
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
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
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, ...
 
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
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
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
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

Mobile web application