Slide 1

Slide 1 text

#weirdbrowsers Weird Browsers Niels Leenheer @html5test

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

383
 Safari 10 499
 Chrome 53 463
 Firefox 49 555 0 desktop browsers results on html5test.com 460
 Edge 14

Slide 4

Slide 4 text

383
 Safari 10 555 0 desktop browsers results on html5test.com 463
 Firefox 49 460
 Edge 14 499
 Chrome 53

Slide 5

Slide 5 text

desktop browsers results on html5test.com 2006 2008 2010 2012 2014 2016 19 33 113 265 312 360 433 460 Edge Internet Explorer

Slide 6

Slide 6 text

new since internet explorer 6

Slide 7

Slide 7 text

JSON encoding and decoding Canvas 2D graphics Video Audio Geolocation SVG graphics Semantic elements Video subtitles App-cache offline support File API’s Form validation HTML5 parser Color input type Drag and drop IndexedDB Page Visibility URL API Device Orientation Full Screen Pointer events Web Crypto Media source extensions Mutation Observer Typed Arrays Internationalisation ES6: Promises Responsive images Adaptive streaming Pointerlock ObjectRTC Blend modes WebAuthentication Fetch Beacons Speech synthesis Streams CSS border image

Slide 8

Slide 8 text

Content security policy PNG transparency support CSS opacity CSS transitions CSS transforms CSS animations Native XMLHTTP DOM3 events VP9 video codec WOFF fonts CSS Selectors CSS Grid Layout ARIA XPath CSS 3D transforms Selection API ES6: WeakMap Touch events CSS Gradients CSS calc CSS Snap Points High Resolution Timing Sandboxed iframes Navigation Timing Screen orientation WebDriver TLS 1.2 SVG External content Regions Image sourceset HSTS Data URLs

Slide 9

Slide 9 text

Local storage Session storage Web Workers Gamepad Notifications Session history Web Sockets WebGL WebAudio Async script execution Cross-origin Resource Sharing Access the webcam ECMAScript 5 CSS Multicolumn Cross-document messaging Device Motion HTTP/2 WebRTC ASM.js CSS Filters Exclusions CSS Flexbox Canvas 2D Path ES6 Classes Console logging CSS unset Date input types Encrypted Media Extensions HTTP/2 server push IME API Media Queries Level 4 Message Channels ES6: Template strings ES6: Subclassing ES6: Arrow functions ES6: Generators

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

weird browsers

Slide 12

Slide 12 text

no, this talk is not about internet explorer 6

Slide 13

Slide 13 text

the web is weird by definition

Slide 14

Slide 14 text

the web is not a single platform

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

?weird browsers?

Slide 17

Slide 17 text

?weird browsers?

Slide 18

Slide 18 text

game consoles

Slide 19

Slide 19 text

portable
 game consoles

Slide 20

Slide 20 text

smart tvs

Slide 21

Slide 21 text

e-readers

Slide 22

Slide 22 text

smartwatches

Slide 23

Slide 23 text

photo cameras

Slide 24

Slide 24 text

fridges

Slide 25

Slide 25 text

cars

Slide 26

Slide 26 text

vr headsets

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

smart tvs and 
 game consoles

Slide 29

Slide 29 text

“big screen browsers”

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

television browsers are pretty good the last generation of television sets use 
 operating systems that originate on mobile

Slide 32

Slide 32 text

427
 LG WebOS 218
 Google TV 199
 LG Netcast 490
 Samsung Tizen 478
 Opera Devices 261
 Panasonic
 Viera smart tv results on html5test.com 555 0 371
 Panasonic
 Firefox OS 352
 Samsung
 2014

Slide 33

Slide 33 text

289
 Playstation 4 57
 Playstation 3 258
 Playstation TV 108
 Xbox 360 256
 Wii U 65
 Wii 555 0 console results on html5test.com 428
 Xbox One with Edge

Slide 34

Slide 34 text

controlling the browser 1

Slide 35

Slide 35 text

the biggest challenge of 
 of big screen browsers

Slide 36

Slide 36 text

navigation (without mouse or touchscreen)

Slide 37

Slide 37 text

d-pad

Slide 38

Slide 38 text

d-pad

Slide 39

Slide 39 text

alternatives

Slide 40

Slide 40 text

analog controllers

Slide 41

Slide 41 text

remotes 
 with trackpad

Slide 42

Slide 42 text

remotes 
 with airmouse

Slide 43

Slide 43 text

second screen

Slide 44

Slide 44 text

many manufacturers also create apps for 
 controlling the smart tv, console or set-top box

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

text input (without keyboard)

Slide 47

Slide 47 text

d-pads

Slide 48

Slide 48 text

text input with the d-pad

Slide 49

Slide 49 text

alternatives

Slide 50

Slide 50 text

remotes
 with keyboards

Slide 51

Slide 51 text

wireless keyboards

Slide 52

Slide 52 text

and apps

Slide 53

Slide 53 text

No content

Slide 54

Slide 54 text

gesture control (throw your hands up in the air,
 and wave ’em like you just don’t care)

Slide 55

Slide 55 text

navigation with gesture control

Slide 56

Slide 56 text

can we control these input methods 
 directly from javascript?

Slide 57

Slide 57 text

the d-pad maybe

Slide 58

Slide 58 text

1 keyboard events window.addEventListener("keypress", function(e) {
 e.preventDefault(); // no navigation
 ... });

Slide 59

Slide 59 text

the gamepad maybe

Slide 60

Slide 60 text

the gamepad api var gamepads = navigator.getGamepads();
 for (var i = 0; i < gamepads.length; i++) {
 ...
 } 1

Slide 61

Slide 61 text

the webcam maybe

Slide 62

Slide 62 text

the getusermedia api navigator.getUserMedia(
 { audio: true, video: { width: 1280, height: 720 } },
 function(stream) { ... },
 function(error) { ... }
 ); 1

Slide 63

Slide 63 text

the difference between 
 a television and a monitor 2

Slide 64

Slide 64 text

overscan (let’s make it a bit more complicated)

Slide 65

Slide 65 text

due to historical reasons televisions will 
 not show the borders of the image

Slide 66

Slide 66 text

the television enlarges all images 
 from the hdmi input by 5% 1920 pixels

Slide 67

Slide 67 text

the television enlarges all images 
 from the hdmi input by 5% 1920 pixels

Slide 68

Slide 68 text

the image is then cropped to 
 1920 by 1080 pixels

Slide 69

Slide 69 text

the image is then cropped to 
 1920 by 1080 pixels

Slide 70

Slide 70 text

overscan causes blurry output +5%

Slide 71

Slide 71 text

solution 1 overscan correction

Slide 72

Slide 72 text

the browser does not use
 the edges of the image 1920 pixels

Slide 73

Slide 73 text

the television will enlarge 
 the image by 5% 1920 pixels

Slide 74

Slide 74 text

and the content is now fully visible, the unused border is cropped out of the final image

Slide 75

Slide 75 text

but not every television set enlarges the 
 image by exactly 5%, this can vary between manufacturers and models

Slide 76

Slide 76 text

configure the correct overscan correction 
 in the system preferences

Slide 77

Slide 77 text

the playstation 4 will always show the browser without overscan correction in full screen mode

Slide 78

Slide 78 text

the playstation 4 will always show the browser without overscan correction in full screen mode

Slide 79

Slide 79 text

solution 2 no overscan

Slide 80

Slide 80 text

it is possible to disable overscan 
 on many television sets ‘screen fit’, ‘pixel perfect’ or ‘just scan’

Slide 81

Slide 81 text

the playstation 3 always shows the 
 browser with overscan correction

Slide 82

Slide 82 text

the viewport (i really need some aspirin!)

Slide 83

Slide 83 text

the visual viewport determines which part of the website will be visible measured in 
 device pixels the visual viewport

Slide 84

Slide 84 text

the visual viewport determines which part of the website will be visible measured in 
 device pixels the visual viewport

Slide 85

Slide 85 text

the visual viewport the visual viewport determines which part of the website will be visible measured in 
 device pixels

Slide 86

Slide 86 text

the layout viewport the layout viewport determines the width in css pixels on which the site will be rendered

Slide 87

Slide 87 text

the layout viewport the layout viewport determines the width in css pixels on which the site will be rendered

Slide 88

Slide 88 text

the layout viewport the layout viewport determines the width in css pixels on which the site will be rendered

Slide 89

Slide 89 text

the default layout viewport is different on 
 every smart tv, console or set-top box between 800 and 1920 css pixels

Slide 90

Slide 90 text

nintendo wii 800 pixels

Slide 91

Slide 91 text

nintendo wii u 980 pixels

Slide 92

Slide 92 text

lg webos 960 pixels

Slide 93

Slide 93 text

microsoft xbox 360 1041 of 1050 pixels

Slide 94

Slide 94 text

microsoft xbox one 1200 of 1236 pixels

Slide 95

Slide 95 text

microsoft xbox one (with edge) 1200 of 1236 pixels

Slide 96

Slide 96 text

sony playstation 3 1824 pixels

Slide 97

Slide 97 text

sony playstation 4 1920 pixels

Slide 98

Slide 98 text

Nintendo Wii 800 LG WebOS 960 Nintendo Wii U 980 Philips 2014 series 980 Google TV 1024 Playstation TV 1024 Samsung Tizen 1024 Xbox 360 1051 Xbox One 1200 LG Netcast 1226 Panasonic Viera 1256 Opera Devices 1280 Samsung 2014 series 1280 Panasonic Firefox OS 1536 Playstation 3 1824 Playstation 4 1920

Slide 99

Slide 99 text

device pixels != device pixels (of course not)

Slide 100

Slide 100 text

sometimes devices pixels are not 
 physical devices pixels, but virtual device pixels the browser renders in a lower resolution 
 which is upscaled to the resolution of the display

Slide 101

Slide 101 text

distance to the screen 3

Slide 102

Slide 102 text

20 inch

Slide 103

Slide 103 text

20 inch

Slide 104

Slide 104 text

10 foot

Slide 105

Slide 105 text

“Make fonts and graphics on the site larger to account for viewing distance. People sit 
 proportionally farther from a TV than from a computer monitor of the same size.” 
 – Internet Explorer for Xbox One Developer Guide https://msdn.microsoft.com/en-us/library/dn532261(v=vs.85).aspx

Slide 106

Slide 106 text

Make your text 
 and images two to 
 three times bigger

Slide 107

Slide 107 text

Make your text 
 and images two to 
 three times bigger

Slide 108

Slide 108 text

Make your text 
 and images two to 
 three times bigger

Slide 109

Slide 109 text

youtube on the big screen

Slide 110

Slide 110 text

youtube on the big screen

Slide 111

Slide 111 text

identifying smart tv’s (css for televisions)

Slide 112

Slide 112 text

css media types @media tv {
 body {
 font-size: 300%; } } × 1

Slide 113

Slide 113 text

css media types all television browsers use the 
 css media type ‘screen’ 1

Slide 114

Slide 114 text

screen size if (screen.width == 1920 && screen.height == 1080) {
 document.body.className += " television";
 } × 2

Slide 115

Slide 115 text

screen size monitors and phones often use 
 hd resolutions, television browsers 
 often use other resolutions 2

Slide 116

Slide 116 text

useragent sniffing if (navigator.userAgent.search(/TV/i) >= 0) {
 document.body.className += " television";
 } × 3

Slide 117

Slide 117 text

useragent sniffing not all smart tv’s are recognisable Mozilla/5.0 (X11; Linux; ko-KR) 
 AppleWebKit/534.26+ (KHTML, like Gecko) 
 Version/5.0 Safari/534.26+ 3

Slide 118

Slide 118 text

couch mode the only reliable way to optimise a website 
 for television is to make two different websites… or give the user the ability to switch on 
 couch mode 4

Slide 119

Slide 119 text

be careful with
 feature detection 4

Slide 120

Slide 120 text

“Basically every feature that talks to the 
 operating system or hardware, is suspect.” 
 – Me, just now http://blog.html5test.com/2015/08/the-problems-with-feature-detection/

Slide 121

Slide 121 text

if (!!navigator.geolocation) { navigator.geolocation.getCurrentPosition(
 success, failure
 ); }
 else {
 // alternative
 }

Slide 122

Slide 122 text

failure is called with a “permission denied” error code 1 no callback at all to success or failure 2 if (!!navigator.geolocation) { navigator.geolocation.getCurrentPosition(
 success, failure
 ); }

Slide 123

Slide 123 text

success is called with longitude = 0 and latitude = 0 3 success is called with the coordinates of 
 Mountain View, USA 4 if (!!navigator.geolocation) { navigator.geolocation.getCurrentPosition(
 success, failure
 ); }

Slide 124

Slide 124 text

No content

Slide 125

Slide 125 text

e-readers

Slide 126

Slide 126 text

e-reader results on html5test.com 555 0 154
 Pocketbook 280
 Kobo 147
 Sony Reader 152
 Kindle Touch

Slide 127

Slide 127 text

infrared touch screen

Slide 128

Slide 128 text

led’s sensors

Slide 129

Slide 129 text

mouse events down/up move touch events amazon kindle touch yes pocketbook basic touch yes kobo glow yes yes sony reader yes yes 1 finger

Slide 130

Slide 130 text

e-ink screens (slow, slower, slowest)

Slide 131

Slide 131 text

microscopic electrostatic charged balls

Slide 132

Slide 132 text

microscopic electrostatic charged balls + – – +

Slide 133

Slide 133 text

+ – – + microscopic electrostatic charged balls

Slide 134

Slide 134 text

microscopic electrostatic charged balls

Slide 135

Slide 135 text

No content

Slide 136

Slide 136 text

maybe css animations and transitions 
 weren’t such a great idea after all

Slide 137

Slide 137 text

two completely different colors can look 
 exactly the same in black and white

Slide 138

Slide 138 text

two completely different colors can look 
 exactly the same in black and white

Slide 139

Slide 139 text

identifying e-readers (css for e-ink screens)

Slide 140

Slide 140 text

css monochrome mediaquery @media (monochrome) {
 ... } × 1

Slide 141

Slide 141 text

css monochrome mediaquery all tested e-readers act like 
 they have a color screen 1

Slide 142

Slide 142 text

useragent sniffing there is no universal marker in the useragent string, but we can recognise individual manufacturers and models 2

Slide 143

Slide 143 text

No content

Slide 144

Slide 144 text

vr headsets vr headsets vr headsets

Slide 145

Slide 145 text

oculus rift

Slide 146

Slide 146 text

htc vive

Slide 147

Slide 147 text

microsoft hololens

Slide 148

Slide 148 text

very expensive

Slide 149

Slide 149 text

but…

Slide 150

Slide 150 text

google cardboard

Slide 151

Slide 151 text

google daydream

Slide 152

Slide 152 text

samsung gear vr

Slide 153

Slide 153 text

No content

Slide 154

Slide 154 text

webvr (webgl on steroids)

Slide 155

Slide 155 text

head tracking and camera geometry project the 3d scene to two different eyes

Slide 156

Slide 156 text

Chrome Firefox Samsung Internet Edge or experimental build nightly builds soon behind a flag or

Slide 157

Slide 157 text

Chrome Firefox Samsung Internet Edge or experimental build nightly builds soon behind a flag or

Slide 158

Slide 158 text

https://iswebvrready.org

Slide 159

Slide 159 text

No content

Slide 160

Slide 160 text

No content

Slide 161

Slide 161 text

No content

Slide 162

Slide 162 text

?weird browsers!

Slide 163

Slide 163 text

“We cannot predict future behavior
 from a current experience that sucks” 
 – Jason Grigsby http://blog.cloudfour.com/on-the-device-context-continuum/

Slide 164

Slide 164 text

but wait…

Slide 165

Slide 165 text

browsers! weird

Slide 166

Slide 166 text

browsers! weird

Slide 167

Slide 167 text

browsers! browsers browsers browsers browsers! browsers browsers browsers browsers browse browsers wsers! browsers

Slide 168

Slide 168 text

No content

Slide 169

Slide 169 text

thank you niels leenheer
 @html5test