1 00:00:00,000 --> 00:00:06,580 Good afternoon, everyone. My name is Ming Chao, and I'm a lecturer at Tufts University in Medford, Massachusetts. 2 00:00:07,080 --> 00:00:13,540 And I am here to talk about HTML5, breaking, abusing, and hacking HTML5. 3 00:00:14,160 --> 00:00:21,820 Just for my curiosity here, raise your hand if you have worked with HTML5 in some capacity already. 4 00:00:22,800 --> 00:00:25,280 Okay, so there's a good number of hands, okay? 5 00:00:25,280 --> 00:00:36,380 There's a good number of hands up, and it shouldn't be a surprise why, I mean, right now there's such a big push for websites and web applications to go down the road of HTML5. 6 00:00:36,620 --> 00:00:47,740 And that's because a lot of devices, you know, well, we don't have a lot of those new devices, tablets, iPhones, iPads, they don't have Flash. 7 00:00:48,120 --> 00:00:51,100 And the other thing is, of course, the browser has gotten really, really, really powerful. 8 00:00:51,520 --> 00:00:53,600 The other thing is, how many people here know JavaScript? 9 00:00:53,760 --> 00:00:55,060 Because I'm going to do a lot of demonstrations. 10 00:00:55,280 --> 00:00:56,260 Okay, a lot of code examples. 11 00:00:56,460 --> 00:00:57,440 Great, great, excellent. 12 00:00:58,540 --> 00:01:02,340 Okay, so just a little intro background material. 13 00:01:02,500 --> 00:01:03,860 What is HTML5? 14 00:01:04,340 --> 00:01:07,320 Well, it's very much like HTML5. 15 00:01:07,340 --> 00:01:12,740 It's going to be the next standard, the next revision of HTML, the mock-up language. 16 00:01:13,200 --> 00:01:17,400 But one of the things that you've got to understand about HTML5 is just not the mock-up language. 17 00:01:17,780 --> 00:01:20,380 It's really a stack of technology. 18 00:01:21,320 --> 00:01:25,260 HTML5 is really dependent on not only dependent on the HTML5. 19 00:01:25,280 --> 00:01:34,680 The mock-up language, but also presentation by way of CSS, and also a lot of JavaScript, you know, interaction with content. 20 00:01:35,220 --> 00:01:41,560 The cool thing is, I'm not going to talk particularly much on server-side stuff, it makes no sense anyway. 21 00:01:41,860 --> 00:01:46,140 But you're close enough using HTML5 as a full-fledged development environment. 22 00:01:46,600 --> 00:01:51,080 There is one caveat that you've got to know about HTML5. 23 00:01:52,160 --> 00:01:53,420 It's still working target. 24 00:01:53,420 --> 00:01:55,280 It's still work-in-progress. 25 00:01:56,080 --> 00:01:59,380 It's that some of the stuff today that I'm going to talk about may change tomorrow. 26 00:02:01,480 --> 00:02:04,180 That's, you know, just watch out. 27 00:02:05,340 --> 00:02:07,780 Who knows when the standard will be finalized? 28 00:02:08,000 --> 00:02:10,940 And, of course, there's backing from Google. 29 00:02:11,480 --> 00:02:19,740 Microsoft is going to get pushed very heavily with Office and with the next version of IE. 30 00:02:20,900 --> 00:02:23,400 Now, not only is HTML5 a mock-up language, it's a mock-up language. 31 00:02:23,420 --> 00:02:25,200 And that's because we need to have HTML5 work in progress. 32 00:02:26,380 --> 00:02:28,380 Different browsers have different standards. 33 00:02:28,540 --> 00:02:32,880 And right now the companies are like Google, Microsoft, they're everyone doing their own thing. 34 00:02:34,280 --> 00:02:41,400 So one of the most, you know, one of the drawbacks of using HTML5 right now, there's so many incompatibilities. 35 00:02:41,880 --> 00:02:45,420 Case in point, it's going to be video, which I'll show you in a few moments, all right? 36 00:02:45,700 --> 00:02:51,080 But to check what your browser can support and do, you really want to go check. 37 00:02:51,260 --> 00:02:52,060 Go to http. 38 00:02:52,180 --> 00:02:53,400 Go to html5.com. 39 00:02:53,420 --> 00:02:59,840 test.com, and it will render a score on your browser, see how compatible, like, what features 40 00:02:59,840 --> 00:03:04,380 your browser, the HTML5 features your browser can use, okay? 41 00:03:04,660 --> 00:03:07,920 The other thing to also keep in mind is there's still going to be people who are going to 42 00:03:07,920 --> 00:03:13,420 be using IE6, IE7, you know, older versions of Firefox, you know, that's not going to 43 00:03:13,420 --> 00:03:20,320 change, but a lot of the HTML5 syntax, when it is going to be rendered on the browser, 44 00:03:20,320 --> 00:03:27,040 it's going to ‑‑ it's still going to render, but all the real cool stuff, they're 45 00:03:27,040 --> 00:03:29,820 not going to be ‑‑ you know, they're just not going to be rendered, okay? 46 00:03:29,980 --> 00:03:36,060 So here's just a quick summary on what's in and what's out in HTML5. 47 00:03:37,220 --> 00:03:39,060 Whole bunch of ‑‑ okay, what's in? 48 00:03:39,300 --> 00:03:47,020 A bunch of new tags, video, audio, there's also semantic ‑‑ tags for semantic stuff 49 00:03:47,020 --> 00:03:49,600 such as article, footer, and nav. 50 00:03:49,860 --> 00:03:50,300 Okay. 51 00:03:50,320 --> 00:03:56,520 Back in the days, and still we do this a lot, a lot of people use div ID equals nav or div 52 00:03:56,520 --> 00:03:59,160 ID equals footer or div ID equals header. 53 00:03:59,960 --> 00:04:04,860 So the nice thing is, one of the standards now is why don't we just instead of doing 54 00:04:04,860 --> 00:04:06,220 div tag, we just have article tag. 55 00:04:06,540 --> 00:04:12,000 I know that in Chrome I can't get too much working with the article and the footer tags. 56 00:04:12,560 --> 00:04:16,960 There's a lot of new attributes, for example, for pattern recognition in form fields. 57 00:04:17,860 --> 00:04:19,280 There are also new media events. 58 00:04:19,280 --> 00:04:24,900 For example, time update, when you want to play a video from one second to two seconds. 59 00:04:26,000 --> 00:04:30,840 Geolocation, you know, that feature that, you know, your browser prompts you to do you 60 00:04:30,840 --> 00:04:34,780 want to use your location, does this page want to use your location, do you want to, 61 00:04:34,780 --> 00:04:35,880 you know, get permission? 62 00:04:36,200 --> 00:04:37,920 I mean, I'm sure a lot of people have seen that. 63 00:04:38,000 --> 00:04:39,800 That's part of HTML5, okay? 64 00:04:39,900 --> 00:04:48,120 And of course, client side storage, which is becoming, like, the next vector for abuse. 65 00:04:48,780 --> 00:04:49,480 What's out? 66 00:04:50,300 --> 00:04:51,380 Font and center tag. 67 00:04:51,500 --> 00:04:57,860 Anything that's presentation-based, font, center, align, border, all right, those are 68 00:04:57,860 --> 00:05:03,100 quote-unquote no longer support, like, quote-unquote no longer supported in the HTML5 standard. 69 00:05:03,380 --> 00:05:03,920 Why? 70 00:05:04,280 --> 00:05:11,900 You know, HTML5, HTML for content generation was never, ever meant for styling purposes. 71 00:05:12,320 --> 00:05:15,760 So they're forcing you now to have all that stuff in CSS. 72 00:05:18,120 --> 00:05:19,760 It's quote-unquote not supported. 73 00:05:19,900 --> 00:05:27,360 By not supported means if you try to validate your page in the official W3C validator, you'll 74 00:05:27,360 --> 00:05:32,280 get a lot of not only warning but error messages, and they'll yell at you, okay? 75 00:05:32,640 --> 00:05:37,920 Applets and old special effects such as, remember the marquee, all right? 76 00:05:38,180 --> 00:05:39,060 Good times. 77 00:05:39,220 --> 00:05:42,380 Background sound, you know, those are no longer supported. 78 00:05:42,720 --> 00:05:46,240 And this one last guy right here, the no script tag, all right? 79 00:05:46,280 --> 00:05:47,320 The no script tag. 80 00:05:47,320 --> 00:05:50,040 I have a snort ball here. 81 00:05:50,160 --> 00:05:53,040 Can someone tell me what the purpose of the no script tag is? 82 00:05:53,220 --> 00:05:56,580 And why do you think it's no longer supported in the HTML5 standard? 83 00:05:59,220 --> 00:05:59,620 Okay. 84 00:05:59,700 --> 00:06:00,720 I'm going to throw it over there. 85 00:06:01,080 --> 00:06:01,940 Someone catch it. 86 00:06:03,040 --> 00:06:03,640 All right. 87 00:06:03,820 --> 00:06:10,200 Now I want to do a few quick demonstrations that illustrate the power of HTML5, okay? 88 00:06:10,340 --> 00:06:14,180 I'm going to do an example on, first of all, a couple of video captioning examples. 89 00:06:14,520 --> 00:06:17,120 And if I have time, I'll also do a geo. 90 00:06:17,260 --> 00:06:17,300 Okay. 91 00:06:17,320 --> 00:06:19,640 I'm going to do a video location as well. 92 00:06:20,240 --> 00:06:21,340 Hopefully this thing will work. 93 00:06:21,540 --> 00:06:21,860 Hello. 94 00:06:22,280 --> 00:06:22,760 Okay. 95 00:06:22,940 --> 00:06:28,260 Now, I had, this is, this was an example, this was a video that was built by a high 96 00:06:28,260 --> 00:06:30,860 school student, Rachel Solmonte. 97 00:06:31,160 --> 00:06:34,180 She's taking my summer class right now at Tufts. 98 00:06:34,480 --> 00:06:37,560 And she did a video called Double Rainbow. 99 00:06:38,540 --> 00:06:43,620 And unfortunately, you know, I'm just going to play, I think the screen resolution will 100 00:06:43,620 --> 00:06:43,880 go up. 101 00:06:43,920 --> 00:06:44,340 But, you know. 102 00:06:44,480 --> 00:06:44,960 Okay. 103 00:06:51,360 --> 00:06:51,720 Okay. 104 00:06:55,640 --> 00:06:56,000 Okay. 105 00:06:56,240 --> 00:06:57,640 Yeah, there's no sound in this. 106 00:06:59,980 --> 00:07:00,340 Okay. 107 00:07:01,360 --> 00:07:01,720 Okay. 108 00:07:01,980 --> 00:07:02,740 It's almost like a – 109 00:07:02,740 --> 00:07:04,660 This is actually, I don't know where, what happened to sound. 110 00:07:05,700 --> 00:07:07,420 But there's a song that plays in the background. 111 00:07:07,480 --> 00:07:12,100 But yeah, it's very much like if you just can imagine if there's sound playing, it's 112 00:07:12,100 --> 00:07:12,320 karaoke. 113 00:07:12,320 --> 00:07:19,160 karaoke. No plug-in necessary. Okay? No plug-in necessary to generate this stuff. Okay? And 114 00:07:19,160 --> 00:07:25,180 you've got SpongeBob. Let's go back. All right? And this is actually one of my favorites. 115 00:07:26,080 --> 00:07:31,900 This was in my web programming class. I had the students, you know, build a video caption. 116 00:07:32,460 --> 00:07:39,700 And this was a great student, a very good student of mine, built a video that took advantage 117 00:07:39,700 --> 00:08:08,500 of fail blog. Again, no plug-in necessary. Okay? No plug-in necessary. So you can do 118 00:08:08,500 --> 00:08:09,680 some really, really cool things. 119 00:08:09,700 --> 00:08:14,540 For example, just picture yourself if you can do, like, videos and, like, interactive 120 00:08:14,540 --> 00:08:17,440 media for accessibility purposes, all right? 121 00:08:23,480 --> 00:08:28,340 Now here's the catch, just to illustrate the problem with HTML5. 122 00:08:28,580 --> 00:08:36,700 This demonstration, this demonstration will not, will only work in Chrome and Firefox. 123 00:08:36,700 --> 00:08:38,540 It will not work in Safari. 124 00:08:40,480 --> 00:08:41,040 Okay? 125 00:08:41,180 --> 00:08:48,500 We're using, we're using org format for the video, all right? 126 00:08:51,740 --> 00:09:04,400 So that's video, and I want to see if this, if I can go to about geolocation, WTF.HTML, 127 00:09:05,020 --> 00:09:06,140 and this. 128 00:09:06,140 --> 00:09:13,640 So this demonstration is an exercise I made my students do, is to find where in the world 129 00:09:13,640 --> 00:09:18,180 is our good friend Carmen Sandiego, based on where we are, okay? 130 00:09:18,420 --> 00:09:24,420 So I built, I built a JSON feed which actually renders ten random locations around the world. 131 00:09:24,500 --> 00:09:30,280 I am actually going to allow, okay, nice that they actually prompt you permission, okay. 132 00:09:30,380 --> 00:09:32,200 So here, here we are. 133 00:09:32,280 --> 00:09:33,300 We are here. 134 00:09:33,700 --> 00:09:34,300 Oh. 135 00:09:34,300 --> 00:09:38,400 And Carmen, of course, she is in the 16th chapel. 136 00:09:38,580 --> 00:09:43,040 If I hit the refresh button again, she is now in Big Ben. 137 00:09:43,140 --> 00:09:45,760 So this is, you know, taking advantage of geolocation. 138 00:09:46,080 --> 00:09:48,700 This was a lab that I had the students do. 139 00:09:49,320 --> 00:09:49,800 Okay. 140 00:09:49,920 --> 00:09:50,260 Let's go back. 141 00:09:50,680 --> 00:09:51,920 Just some quick demos. 142 00:09:53,460 --> 00:09:56,540 So how does an HTML5 document look like? 143 00:09:57,220 --> 00:09:58,320 There's not much to it. 144 00:09:58,500 --> 00:10:03,180 If you know about HTML, the mark, if you know a little bit about HTML, then transitioning 145 00:10:03,180 --> 00:10:05,740 over to HTML5 is not difficult at all. 146 00:10:06,260 --> 00:10:08,520 The only one thing that you really need is the doc type. 147 00:10:08,880 --> 00:10:09,820 And look at this. 148 00:10:10,120 --> 00:10:16,260 You know, is less than pound, you know, exclamation point, doc type, HTML. 149 00:10:16,540 --> 00:10:17,100 That's all you need. 150 00:10:17,560 --> 00:10:23,440 A lot better than the doc type for HTML, isn't it? 151 00:10:23,540 --> 00:10:24,100 Pretty nice. 152 00:10:24,220 --> 00:10:24,820 That's it. 153 00:10:25,120 --> 00:10:28,760 And everything else really looks the same, okay? 154 00:10:29,660 --> 00:10:32,060 So where are we with areas of concern? 155 00:10:32,060 --> 00:10:35,180 So where's the danger, okay? 156 00:10:35,300 --> 00:10:40,440 The danger, of course, is with the web browser, the client side, all right? 157 00:10:40,960 --> 00:10:46,060 Now because HTML5 can do so much, you can now see the complexity, I mean, you can understand 158 00:10:46,060 --> 00:10:48,580 the complexity of a web browser, all right? 159 00:10:49,040 --> 00:10:53,880 You can do so much stuff, including, like, client side, like offline storage, okay? 160 00:10:54,640 --> 00:11:00,300 Now not only can you actually store a lot more information, content. 161 00:11:01,640 --> 00:11:02,040 But you can do so much more. 162 00:11:02,060 --> 00:11:06,020 But just imagine if you have a full ‑‑ almost a full‑fledged SQL database on the 163 00:11:06,020 --> 00:11:07,400 client side, okay? 164 00:11:08,220 --> 00:11:13,060 How about, you know, AJAX and the XML HTTP request object? 165 00:11:13,320 --> 00:11:16,760 Remember in JavaScript there was the same domain policy. 166 00:11:18,340 --> 00:11:23,840 But now you can actually do cross‑origin requests and even cross‑document messaging 167 00:11:23,840 --> 00:11:25,300 as well, okay? 168 00:11:25,680 --> 00:11:31,480 And I'm going to show you a little bit ‑‑ a little demo on ‑‑ yes. 169 00:11:31,480 --> 00:11:37,400 You can actually do, you know, for example, calculating prime numbers or whatever comes 170 00:11:37,400 --> 00:11:40,020 to your mind by way of web workers. 171 00:11:40,400 --> 00:11:42,520 Think of background threads, okay? 172 00:11:43,140 --> 00:11:47,280 And again, HTML5 is certainly going to make the browsers worse. 173 00:11:47,400 --> 00:11:52,920 I mean, last time I checked, I remember the Chrome bounty that just recently happened, 174 00:11:53,000 --> 00:11:58,600 and I think two of them were specific to HTML5 features on Chrome, okay? 175 00:11:59,540 --> 00:12:01,460 And the first thing I want to talk about is local storage. 176 00:12:01,480 --> 00:12:03,620 So local storage and session storage. 177 00:12:04,160 --> 00:12:07,480 We all know the good thing known as ‑‑ the thing known as cookies, right? 178 00:12:07,980 --> 00:12:10,480 Now here's the deal about cookies, just for your reminder. 179 00:12:11,080 --> 00:12:13,980 A cookie can only store four kilobytes of information. 180 00:12:14,980 --> 00:12:16,920 Local storage really depends on the browser. 181 00:12:17,080 --> 00:12:19,660 Last time I actually checked, it's around five ‑‑ you can store five megabytes 182 00:12:19,660 --> 00:12:23,100 of data, okay, for a local storage item, okay? 183 00:12:23,320 --> 00:12:27,320 If you actually can understand the whole concept of cookies and sessions, I mean, local storage 184 00:12:27,320 --> 00:12:28,480 and session storage, same idea. 185 00:12:29,180 --> 00:12:30,120 Key value storage. 186 00:12:30,460 --> 00:12:31,460 Very, very simple. 187 00:12:31,480 --> 00:12:31,980 It's very simple to use. 188 00:12:32,080 --> 00:12:34,060 It's ridiculously simple to use, okay? 189 00:12:34,600 --> 00:12:38,700 Persistence is that the only difference between local storage and session storage is persistence, 190 00:12:38,980 --> 00:12:39,360 okay? 191 00:12:39,460 --> 00:12:43,240 Session storage, if you can infer from the name, it only lasts, you know, until the 192 00:12:43,240 --> 00:12:44,980 browser is closed, okay? 193 00:12:45,380 --> 00:12:47,140 Local storage, something else. 194 00:12:47,520 --> 00:12:51,500 How do you use local storage or session storage by way of JavaScript? 195 00:12:52,040 --> 00:12:52,920 Really simple. 196 00:12:53,100 --> 00:12:59,700 These are local storage or session storage dot get item, dot set item, okay, or delete 197 00:12:59,700 --> 00:13:00,120 item. 198 00:13:00,120 --> 00:13:05,580 Or, if you prefer, you can use the associative array to hash syntax, okay, using square brackets. 199 00:13:05,940 --> 00:13:07,940 Here is just an example. 200 00:13:08,620 --> 00:13:10,740 Let's go back, okay? 201 00:13:12,280 --> 00:13:15,560 So here we are. 202 00:13:15,940 --> 00:13:17,760 Local storage example dot HTML. 203 00:13:19,100 --> 00:13:20,760 The phrase that pays is bonkers. 204 00:13:21,400 --> 00:13:25,860 Now, if I type in doo and doo doo. 205 00:13:29,360 --> 00:13:29,920 Okay. 206 00:13:30,000 --> 00:13:30,100 Okay. 207 00:13:31,820 --> 00:13:33,200 So I'm in Chrome. 208 00:13:33,700 --> 00:13:41,920 And using Chrome developer tools, go to view, go to developer tools, okay, under resources, 209 00:13:43,080 --> 00:13:48,540 all right, you see databases, local storage, session storage, cookies, application cache. 210 00:13:48,880 --> 00:13:52,280 Let's go to local storage and see what happens, okay? 211 00:13:54,020 --> 00:13:55,040 Here is my domain. 212 00:13:55,320 --> 00:13:57,300 192.168.156.130. 213 00:13:58,080 --> 00:13:59,900 And, of course, key value pairs. 214 00:14:00,020 --> 00:14:00,100 Okay. 215 00:14:00,700 --> 00:14:01,880 You take a look. 216 00:14:02,060 --> 00:14:07,140 My key is just, I'm just using, I'm just generating time stamps as my key. 217 00:14:07,480 --> 00:14:11,360 And the value, of course, is everything that I have entered, okay? 218 00:14:11,540 --> 00:14:12,380 Not too hard. 219 00:14:12,780 --> 00:14:15,360 Let's go over and just view the source, okay? 220 00:14:15,980 --> 00:14:19,720 View, view source, all right? 221 00:14:20,000 --> 00:14:22,520 So my body is really, really simple. 222 00:14:22,580 --> 00:14:24,340 There's not much to it, okay? 223 00:14:24,860 --> 00:14:27,820 Just one div, one result, all right? 224 00:14:28,520 --> 00:14:29,640 One form tag. 225 00:14:30,100 --> 00:14:30,960 Look at my init function. 226 00:14:32,940 --> 00:14:36,880 First time it goes, first time the page loads is local storage dot set item. 227 00:14:37,060 --> 00:14:40,660 The key is phrase and the value is bonkers, all right? 228 00:14:41,880 --> 00:14:47,020 So if I actually hit return, okay, store. 229 00:14:47,680 --> 00:14:53,640 When I actually type something in, store is, okay, first get the thing that was in the 230 00:14:53,640 --> 00:14:59,560 text box, local storage, and, of course, the index, I mean, the key is going to be a time 231 00:14:59,560 --> 00:15:02,040 stamp equals text, all right? 232 00:15:02,940 --> 00:15:07,460 And how you render out all each and every item onto the page is I just do a very simple 233 00:15:07,460 --> 00:15:13,980 for loop and just, you know, go through my local storage and just render everything out 234 00:15:13,980 --> 00:15:15,260 to the page, okay? 235 00:15:16,280 --> 00:15:19,360 Very, very similar to the whole concept of cookies, all right? 236 00:15:19,400 --> 00:15:20,660 You got the same domain policy. 237 00:15:21,100 --> 00:15:25,400 But of course, well, let's go back. 238 00:15:25,700 --> 00:15:29,020 I actually want to change something to, actually, I'm going to come here. 239 00:15:29,220 --> 00:15:29,540 I'm going to go back. 240 00:15:31,380 --> 00:15:37,880 And I'm going to say, all right, but what's one of the things that you can do with local 241 00:15:37,880 --> 00:15:38,300 storage? 242 00:15:38,620 --> 00:15:40,860 Go to view, go to developer tools again. 243 00:15:41,920 --> 00:15:54,700 And now I can go to local storage and instead of do do, I can type h1, okay, and hit enter. 244 00:15:55,320 --> 00:15:59,540 And instead of do, I can have image src.exe. 245 00:15:59,560 --> 00:16:07,220 I don't care what it is, okay, get out of here, and I'm going to type Batman, and watch 246 00:16:07,220 --> 00:16:09,060 what happens, okay? 247 00:16:10,300 --> 00:16:15,520 And of course, well, this is broken, there's no image there, but you do see that now trap 248 00:16:15,520 --> 00:16:18,820 actually is the, you know, and as header one now takes into effect. 249 00:16:19,980 --> 00:16:24,160 So now you're starting to see some of the old hacks, okay? 250 00:16:24,420 --> 00:16:27,960 Some really age-old security principles, okay? 251 00:16:27,960 --> 00:16:30,400 So, think about this for a second. 252 00:16:30,880 --> 00:16:31,700 Here's the analogy. 253 00:16:32,440 --> 00:16:37,940 Is there a way that you can grab all the cookies on a person's machine? 254 00:16:38,340 --> 00:16:42,560 Other than beating the person up and taking their machine, which, of course, that is another 255 00:16:42,560 --> 00:16:44,300 thing that you can do with local storage. 256 00:16:44,360 --> 00:16:49,220 You can steal someone's machine and look into, you know, take, open their browser and 257 00:16:49,220 --> 00:16:50,020 just do what I did. 258 00:16:50,100 --> 00:16:55,640 You can see all the other values, but, you know, what's the other way that you can steal 259 00:16:55,640 --> 00:16:56,340 everyone's cookies? 260 00:16:58,080 --> 00:16:58,680 What's the attack? 261 00:16:58,800 --> 00:16:59,720 What attack do you use? 262 00:17:01,040 --> 00:17:01,440 Exactly. 263 00:17:02,020 --> 00:17:02,960 Oh, look at this. 264 00:17:03,340 --> 00:17:07,780 If you have a cross-site scripting vulnerability in your application, look at everything in 265 00:17:07,780 --> 00:17:11,480 local storage that's going to be susceptible, and there's a simple example, okay? 266 00:17:11,980 --> 00:17:13,220 And it just befuddles me. 267 00:17:13,300 --> 00:17:17,080 This is always a principle that I always, I mean, as dumb as this sounds, you're always 268 00:17:17,080 --> 00:17:20,560 going to have people that decide to want to store really sensitive information in local 269 00:17:20,560 --> 00:17:21,060 storage. 270 00:17:21,460 --> 00:17:21,860 Why? 271 00:17:23,060 --> 00:17:23,460 Okay? 272 00:17:24,780 --> 00:17:26,300 Next up, WebSQL. 273 00:17:26,800 --> 00:17:27,680 This is not new. 274 00:17:28,300 --> 00:17:32,320 This is not new, but I'm sure some of you, how many people remember the good old days 275 00:17:32,320 --> 00:17:33,080 of Google Gears? 276 00:17:33,900 --> 00:17:36,500 Unfortunately, you had to download a plug-in for that thing, okay? 277 00:17:37,340 --> 00:17:42,260 Now, this will bring SQL largely, like, a lot of, you know, good stuff to the client 278 00:17:42,260 --> 00:17:42,540 side. 279 00:17:43,200 --> 00:17:45,600 Here's some of the core methods, all right? 280 00:17:45,680 --> 00:17:47,920 You have open database, okay? 281 00:17:48,440 --> 00:17:52,140 You have transaction, and you have execute SQL, okay? 282 00:17:52,440 --> 00:17:54,460 Even prepared statements are supported. 283 00:17:55,120 --> 00:17:57,800 But you do also have the usual game. 284 00:17:57,960 --> 00:18:00,360 Signing of attacks, cross-site scripting, SQL injection. 285 00:18:01,020 --> 00:18:04,260 Let me show you an example, okay? 286 00:18:04,340 --> 00:18:07,080 Let's go back, all right? 287 00:18:07,140 --> 00:18:09,580 And I got three simple examples, three examples. 288 00:18:10,240 --> 00:18:12,060 I am going to close out of this. 289 00:18:13,140 --> 00:18:21,060 And now, I am going to do actual size, and let's go to WebSQL example number one, okay? 290 00:18:21,940 --> 00:18:25,300 And I'm going to say something, just really rudimentary. 291 00:18:25,660 --> 00:18:26,600 Go get me a beer. 292 00:18:27,280 --> 00:18:27,720 Homer. 293 00:18:27,860 --> 00:18:27,940 Homer. 294 00:18:28,600 --> 00:18:29,040 Okay? 295 00:18:29,900 --> 00:18:32,400 Homer says, go get me a beer, all right? 296 00:18:37,720 --> 00:18:38,160 Okay? 297 00:18:40,580 --> 00:18:43,600 Now, I'm going to hit kick and hit enter, all right? 298 00:18:43,600 --> 00:18:44,500 So, where's the data stored? 299 00:18:45,220 --> 00:18:54,700 Well, again, in Chrome, go to developer, developer tools, go to resources, now go to databases. 300 00:18:55,800 --> 00:18:56,240 Now. 301 00:18:56,240 --> 00:19:00,000 My database, I have one database called demo-mchow. 302 00:19:01,000 --> 00:19:02,340 And I can expand it. 303 00:19:03,000 --> 00:19:05,680 And I have one table called thoughts. 304 00:19:06,740 --> 00:19:07,180 Okay? 305 00:19:07,660 --> 00:19:08,700 I have a date key. 306 00:19:08,880 --> 00:19:11,420 I have three fields, date key, phrase, and handle. 307 00:19:11,820 --> 00:19:12,440 All right? 308 00:19:13,020 --> 00:19:16,740 Now, if I go to, all right? 309 00:19:18,660 --> 00:19:19,100 Okay. 310 00:19:19,220 --> 00:19:19,320 All right. 311 00:19:28,380 --> 00:19:28,780 General. 312 00:19:31,420 --> 00:19:33,400 I don't know why that's not showing up for some reason. 313 00:19:34,480 --> 00:19:36,700 I'm going to vote for tools, demo. 314 00:19:42,560 --> 00:19:42,960 Okay? 315 00:19:43,580 --> 00:19:46,380 Well, at any rate, how this works. 316 00:19:46,840 --> 00:19:47,500 Use source. 317 00:19:50,200 --> 00:19:59,620 this is what happens so DB open database DB equals open database you give it a database name you give 318 00:19:59,620 --> 00:20:05,180 it a version number some description and of course the last field the 5000 or open database is some 319 00:20:05,180 --> 00:20:14,320 size okay and here's around roughly five megabytes so I'm only going to you know open a create a new 320 00:20:14,320 --> 00:20:23,200 beta database if you know it's you know if it is if it doesn't exist already if the database 321 00:20:23,200 --> 00:20:30,180 already you know if not exists create table you notice one thing about when I'm creating 322 00:20:30,180 --> 00:20:35,660 the table called thoughts the three fields doesn't take in any data type no database 323 00:20:35,660 --> 00:20:43,140 data types needed so it's pretty loose okay now how do I insert data yeah 324 00:20:44,320 --> 00:20:53,940 uh well I do a transaction DB transaction and I inside is a function execute SQL and 325 00:20:54,500 --> 00:21:02,920 there is my SQL statement right here so of course you know another oldie but goodie this 326 00:21:02,920 --> 00:21:09,900 is bad I mean this is bad principal improvement to make of course is to use prepared statements 327 00:21:09,900 --> 00:21:14,300 all right now let's go to an example not example one of a one but example number 328 00:21:14,300 --> 00:21:31,340 number two. Okay. Okay. That works. Of course, we got a broken image. But let's take a look 329 00:21:31,340 --> 00:21:34,160 at the difference in this thing. Let's take a look at the difference. Got a view source. 330 00:21:35,200 --> 00:21:41,180 Everything is the same except for one thing. Okay. This is a user-prepared statement. Okay. 331 00:21:41,180 --> 00:21:46,740 Execute SQL insert into thoughts, of course. Find the variables with question mark. Okay. 332 00:21:47,540 --> 00:21:52,340 Of course, this is nice, but we can do a little bit better. All right. We can do a little 333 00:21:52,340 --> 00:21:57,060 bit better. How about escaping all the special characters? All right. Some things that, you 334 00:21:57,060 --> 00:22:03,340 know, it doesn't hurt reminding everyone. Image source. Okay. How do I actually did 335 00:22:03,340 --> 00:22:07,860 this is very simple. I just wrote my own JavaScript. I just wrote, you know, HTML and code. I 336 00:22:07,860 --> 00:22:10,120 just encoded all the HTML. That's about it. 337 00:22:10,120 --> 00:22:17,800 All right. So now we've seen local and session storage. We've seen Web SQL. All right. Again, 338 00:22:19,060 --> 00:22:24,660 just, you know, the defenses, again, well, don't store sensitive data in the client-side 339 00:22:24,660 --> 00:22:29,980 database. You know, very much like Chrome, like local storage, session storage, you can 340 00:22:29,980 --> 00:22:35,280 see all the data in the browser. Okay. The other thing is, why do you think, I mean, 341 00:22:35,300 --> 00:22:40,100 what's the real power behind local storage and Web SQL? I mean, why is it so, you know, 342 00:22:40,100 --> 00:22:46,880 why is it so useful? Yeah, because, you know, not only for, you know, cookie and tracking 343 00:22:46,880 --> 00:22:52,700 purposes, everyone here should read the paper on the EverCookies, but also if you're going 344 00:22:52,700 --> 00:22:57,360 to do offline work. Okay. So if you're going to work offline and then you're trying to 345 00:22:57,360 --> 00:23:02,620 sync online when you go online, can you really, really trust what is stored on the client-side? 346 00:23:03,760 --> 00:23:08,420 All right. One other suggestion, of course, is to create your database and store data 347 00:23:08,420 --> 00:23:09,180 over SSL. 348 00:23:09,640 --> 00:23:10,080 Okay. 349 00:23:10,100 --> 00:23:15,460 Oh, and one last thing is, I mentioned a few times when I, especially during geolocation, 350 00:23:15,700 --> 00:23:19,820 it's nice, of course, if you prompt the user, you know, good feedback to just say, you know, 351 00:23:19,900 --> 00:23:26,600 hey, we would like to use your database. Can we do so? Okay. Or, you know, application 352 00:23:26,600 --> 00:23:33,980 cache. Application cache is really, really cool for offline, using a lot of games. For 353 00:23:33,980 --> 00:23:39,040 example, if you're going to be on a mobile device, you can't depend that it's going to 354 00:23:39,040 --> 00:23:39,460 be on a... 355 00:23:40,100 --> 00:23:43,160 You can't depend on networking all the time. Let's say if you're going to be having, like, 356 00:23:43,200 --> 00:23:49,480 you have an HTML5 game. All right. Also reduces a lot of server load. Okay. Right now, if 357 00:23:49,480 --> 00:23:53,900 I'm not mistaken, the size limit for cache data is around five megabytes. There are two 358 00:23:53,900 --> 00:23:58,480 things that you need to do in order to enable application cache. First thing is, in the 359 00:23:58,480 --> 00:24:04,340 HTML tag, specify the manifest file by way of the manifest attribute equals, let's give 360 00:24:04,340 --> 00:24:07,640 it an example, that manifest. So that's the file that's going to be stored on the root 361 00:24:08,680 --> 00:24:09,680 level of the server. 362 00:24:10,100 --> 00:24:15,560 Of the WWW folder. But, of course, the manifest file, example.manifest, is going to look like 363 00:24:15,560 --> 00:24:26,600 the following. You state the files that need to be explicitly cached. HTML, CSS, you know, 364 00:24:26,640 --> 00:24:33,960 all the static content. You can also specify what content need to be... Need required 365 00:24:33,960 --> 00:24:39,740 network... You know, require networking. Okay. How you update the application cache, you can 366 00:24:39,740 --> 00:24:45,800 add an event listener. All right. Update. And, of course, the attribute, you know, the 367 00:24:45,800 --> 00:24:50,320 event is going to be checking. And, you know, the function, you write a function called 368 00:24:50,320 --> 00:24:55,380 update cache data to just do something. Well, one of the things about the danger points 369 00:24:55,380 --> 00:25:00,200 about the application cache is it can be poisoned. All right. The point, the purpose 370 00:25:00,200 --> 00:25:09,080 is, not only there's no permission necessary for any site to cache data onto the browser, 371 00:25:09,740 --> 00:25:16,960 look, what are you really caching? And there's a real big catch. Okay. So what happens is, 372 00:25:17,040 --> 00:25:22,000 although the root resource is cached, but the normal cache is updated but not the application 373 00:25:22,000 --> 00:25:34,080 cache. Okay. Cross origin. JavaScript request. Okay. This is not directly part of the HTML5, 374 00:25:34,260 --> 00:25:38,860 but it is introduced. So, of course, if you remember from... 375 00:25:38,860 --> 00:25:39,720 S? 376 00:25:39,740 --> 00:25:44,040 xhr. It follows large back in the good old days. It largely follows the 377 00:25:44,040 --> 00:25:52,540 same domain principle. Okay? IE and ie8, there is a new JavaScript object called 378 00:25:52,540 --> 00:26:04,840 X domain request. Even now, in a lot of cases, like in Firefox or in Chrome, the xhr can actually 379 00:26:04,840 --> 00:26:08,060 allow for cross- domain requests. How? 380 00:26:08,420 --> 00:26:09,720 You guys remember the? 381 00:26:09,720 --> 00:26:15,500 Remember that the source, remember that example with Carmen Sandiego, well, let's take a look. 382 00:26:16,460 --> 00:26:29,240 If you actually, I'm going to go in, bar www, I'm just going to give you a little snapshot 383 00:26:29,240 --> 00:26:44,560 more, and, of course, the script that is used in the request.open in XHR is Acme, oh, actually 384 00:26:44,560 --> 00:26:51,800 I don't have it here, oh, XDR.php, and there you go. 385 00:26:52,000 --> 00:26:56,480 I know it's a little bit, let me zoom this in. 386 00:26:57,360 --> 00:26:58,420 Zoom this in. 387 00:26:58,680 --> 00:26:59,220 Okay. 388 00:26:59,240 --> 00:27:04,880 How Carmen, how I get the JSON for the Carmen Sandiego demo, well, it's just a few lines 389 00:27:04,880 --> 00:27:05,300 of PHP. 390 00:27:06,140 --> 00:27:15,040 But what I do is I specify the header, okay, there's a flag called access-control-allow-origin, 391 00:27:15,060 --> 00:27:22,180 followed by a colon, and then it should follow a whitelist of allowed sites. 392 00:27:22,980 --> 00:27:25,120 I'm using an asterisk here. 393 00:27:25,860 --> 00:27:27,340 Now, this is not good. 394 00:27:27,540 --> 00:27:28,920 This is a wild card. 395 00:27:28,920 --> 00:27:30,120 All right. 396 00:27:30,140 --> 00:27:35,180 I'm allowing everyone and everyone in the world to actually have access to this data. 397 00:27:35,820 --> 00:27:39,780 This is bad, okay, if you're going to use a wild card. 398 00:27:40,660 --> 00:27:43,720 What's even worse is the following. 399 00:27:45,080 --> 00:27:51,700 What if, okay, I do access-control-allow-origin, HTTP colon, of course, and, of course, some 400 00:27:51,700 --> 00:27:56,720 origin, but, you know, and then I have percent, what is wrong with that second example? 401 00:27:57,600 --> 00:27:58,200 Okay. 402 00:27:58,200 --> 00:28:04,680 How do you actually separate, okay, a whitelist of allowed websites is using a space. 403 00:28:05,460 --> 00:28:10,820 You put that one, you put that in, it's going to, the percent 20, well, it's going to be 404 00:28:10,820 --> 00:28:12,360 equated into a space. 405 00:28:12,700 --> 00:28:17,080 And so you have actually not one, you have two domains that are allowed. 406 00:28:18,240 --> 00:28:21,260 Well, how do you get around, how do you actually, what's the defense? 407 00:28:21,840 --> 00:28:22,600 Two things. 408 00:28:22,740 --> 00:28:27,060 Number one, you want to add some, of course, either A, some sort of authentication or some 409 00:28:27,060 --> 00:28:27,340 key. 410 00:28:27,340 --> 00:28:33,080 Key, like Google Maps did back in the days, or validate the response, okay? 411 00:28:34,320 --> 00:28:35,560 Cross-document messaging. 412 00:28:35,820 --> 00:28:41,900 It is possible to actually, you know, to actually build, for example, a chat, you know, a chat 413 00:28:41,900 --> 00:28:46,620 application using straight HTML5 now, using the whole idea of post message. 414 00:28:47,000 --> 00:28:52,640 You can communicate, you know, between two different domains, two different, you know, 415 00:28:52,660 --> 00:28:55,600 two different, two different origins, two different frames. 416 00:28:55,840 --> 00:28:56,000 Okay. 417 00:28:57,340 --> 00:29:00,460 Two parts of the, two parts, there's a sender and there's a receiver. 418 00:29:01,000 --> 00:29:05,900 The purpose of the sender, okay, of what the sender will do, it will post a message, 419 00:29:06,120 --> 00:29:10,980 while the receiver is going to listen for messages being sent. 420 00:29:11,960 --> 00:29:13,380 Now, I'm just going to give you a demo. 421 00:29:14,640 --> 00:29:15,140 Okay. 422 00:29:16,220 --> 00:29:17,300 Here is a demo. 423 00:29:18,020 --> 00:29:21,680 Actually, this time I will need, okay. 424 00:29:23,580 --> 00:29:27,100 So I have CDM receiver on the server. 425 00:29:27,240 --> 00:29:27,320 Okay. 426 00:29:30,180 --> 00:29:31,620 I'm going to view source. 427 00:29:34,360 --> 00:29:34,820 Okay. 428 00:29:35,100 --> 00:29:39,900 Now, the domain of the receiver is 192.168.156.130. 429 00:29:40,540 --> 00:29:46,800 And look, the receiver is going to have, I mean, the code is it's going to have one event 430 00:29:46,800 --> 00:29:47,240 listener. 431 00:29:48,120 --> 00:29:48,780 All right. 432 00:29:49,420 --> 00:29:53,560 It's going to listen for a message, and then it's going to check for the origin. 433 00:29:55,040 --> 00:29:55,760 All right. 434 00:29:56,320 --> 00:29:56,780 So. 435 00:29:56,780 --> 00:29:57,940 So, what about the sender? 436 00:29:58,540 --> 00:30:04,280 Well, all I can do, I'm going to open file, I'm going to open a file on my desktop. 437 00:30:09,820 --> 00:30:16,060 My desktop, DC 19, examples, okay, CDM sender. 438 00:30:18,580 --> 00:30:19,260 Here it is. 439 00:30:20,360 --> 00:30:21,480 This is a sender. 440 00:30:22,760 --> 00:30:23,720 That's an iframe. 441 00:30:23,860 --> 00:30:25,560 That contains code to the receiver. 442 00:30:26,320 --> 00:30:27,060 View source. 443 00:30:29,020 --> 00:30:29,540 Okay. 444 00:30:32,840 --> 00:30:37,960 So, what I do is, you know, have one text field. 445 00:30:39,020 --> 00:30:39,540 Okay. 446 00:30:39,560 --> 00:30:40,240 One form field. 447 00:30:41,680 --> 00:30:44,980 And then all it's going to do, where is the post message? 448 00:30:46,080 --> 00:30:47,300 Just short this. 449 00:30:47,480 --> 00:30:48,120 Here it is. 450 00:30:48,220 --> 00:30:49,220 One iframe. 451 00:30:50,240 --> 00:30:51,920 And the post message. 452 00:30:53,520 --> 00:30:54,440 Post message. 453 00:30:54,440 --> 00:31:08,460 message. The message and, of course, the domain. So how this works. Okay. Hello. Goodbye. And 454 00:31:08,460 --> 00:31:16,320 remember, okay, it is everything is all listened by way of the receiver on 192 on my virtual 455 00:31:16,320 --> 00:31:28,060 machine. So what's the problem here? Well, here's the catch. You really also want to verify where 456 00:31:28,060 --> 00:31:36,620 the message is coming from. Okay. And you can do that. All right. There is when you are the 457 00:31:36,620 --> 00:31:42,120 receiver, when you're listening for a message, okay, the callback to receive a message, it takes 458 00:31:42,120 --> 00:31:45,920 in one argument, the event. You can check where the origin is. Okay. 459 00:31:46,320 --> 00:31:50,500 Event.Origin equals equals or does not equal. All right. And you can check the origin that 460 00:31:50,500 --> 00:31:56,400 way. Okay. Yeah. It's also been a subject of controversy. For more information, of course, 461 00:31:56,440 --> 00:32:03,020 check out the Mozilla SDK documentation. All right. Some really powerful stuff, web workers. 462 00:32:03,360 --> 00:32:09,440 How do you actually add comp you can now add really computational power, you know, to 463 00:32:09,440 --> 00:32:14,640 the background of whatever page you're actually working on. Okay. Think of threads. Okay. 464 00:32:14,780 --> 00:32:16,300 And it is really, really powerful. 465 00:32:16,300 --> 00:32:22,720 It's really, really easy to use. All right. Very, very easy to use. How you actually spawn a 466 00:32:22,720 --> 00:32:29,960 worker? Well, you set a variable. W equals new worker. Okay. And, of course, the parameter is 467 00:32:29,960 --> 00:32:39,560 going to be, say, some JavaScript file. All right. On message, of course, you can also have 468 00:32:39,560 --> 00:32:46,080 that JS file actually send back messages to you. Okay. And to terminate the 469 00:32:46,300 --> 00:32:50,900 thread, you just do, well, it's going to be W.terminate. Okay. There are some few caveats. 470 00:32:51,120 --> 00:32:56,100 For example, a web worker has to be on a server. It cannot run on the machine. Okay. The same 471 00:32:56,800 --> 00:33:02,460 origin principle applies. But here's the real funny stuff that the worker have access 472 00:33:02,460 --> 00:33:07,260 to. What stuff does a worker have access to? It have access to, oh, the navigation object, 473 00:33:07,960 --> 00:33:13,660 the XHR. Even the application cache and the ability to spawn other workers. Really, really 474 00:33:13,660 --> 00:33:13,900 cool. 475 00:33:13,900 --> 00:33:18,400 What the worker on the flip side does not have access to, of course, is, like, the document 476 00:33:18,400 --> 00:33:27,400 object and the window. What can you do with this? Use your wildest imagination. Someone 477 00:33:27,400 --> 00:33:33,640 here tried to build a password cracker with this thing. You can now do this. All right. 478 00:33:34,000 --> 00:33:43,880 Now how does this work? I'll give you an example. Get out of here. Go back. All right. 479 00:33:43,900 --> 00:34:02,800 And this, okay, what's the example? Ah, here it is. Worker test. All right. And, yeah, there's 480 00:34:02,800 --> 00:34:08,840 no way to kill this thing, either. There's no X button to stop this. All right. How this 481 00:34:08,840 --> 00:34:10,800 works, I have the HTML. 482 00:34:12,680 --> 00:34:17,300 Let me ‑‑ yeah, it's still going to run, but I don't want to crash this machine. 483 00:34:18,140 --> 00:34:18,600 Okay. 484 00:34:19,320 --> 00:34:20,320 There it is. 485 00:34:20,380 --> 00:34:21,040 There's even more. 486 00:34:21,540 --> 00:34:25,720 So there's no way to stop this other than for me to close the browser. 487 00:34:26,540 --> 00:34:27,180 All right. 488 00:34:27,220 --> 00:34:28,240 So how this really works? 489 00:34:28,780 --> 00:34:31,020 Well, let me show you what really happens. 490 00:34:32,040 --> 00:34:32,500 Clear. 491 00:34:33,580 --> 00:34:34,040 Okay. 492 00:34:34,320 --> 00:34:37,820 More worker.js. 493 00:34:38,720 --> 00:34:39,320 That's it. 494 00:34:40,760 --> 00:34:41,560 That's a script. 495 00:34:42,000 --> 00:34:42,480 Okay. 496 00:34:42,660 --> 00:34:45,200 Just a very simple script to just find the prime numbers. 497 00:34:45,980 --> 00:34:47,100 How the page looks. 498 00:34:49,360 --> 00:34:52,580 More worker test2.html. 499 00:34:53,500 --> 00:34:54,240 Here it is. 500 00:34:54,360 --> 00:34:55,240 Very simple markup. 501 00:34:55,600 --> 00:34:56,640 One core computation. 502 00:34:57,240 --> 00:34:57,920 All right. 503 00:34:58,020 --> 00:34:59,320 I have one script tag. 504 00:34:59,940 --> 00:35:00,340 Okay. 505 00:35:00,500 --> 00:35:05,420 Worker equals new worker, and it will point to that worker JavaScript file that I just showed you. 506 00:35:05,740 --> 00:35:06,400 All right. 507 00:35:06,860 --> 00:35:09,300 And, of course, you can actually check. 508 00:35:09,320 --> 00:35:16,160 If there is an event from the JS file sent back to you by, well, worker.onMessage. 509 00:35:16,320 --> 00:35:19,300 That's when you're going to be receiving messages from the JS file. 510 00:35:19,760 --> 00:35:20,820 Actually, let me go back. 511 00:35:21,360 --> 00:35:21,780 Okay. 512 00:35:22,340 --> 00:35:28,160 How this JS file, this thing that gets spawned, sends messages back to your page. 513 00:35:28,420 --> 00:35:29,580 Look at that last line. 514 00:35:29,700 --> 00:35:30,260 It's a post message. 515 00:35:31,200 --> 00:35:31,760 Okay. 516 00:35:31,800 --> 00:35:35,100 It will send data back to the HTML page. 517 00:35:36,400 --> 00:35:36,960 Okay. 518 00:35:37,560 --> 00:35:38,580 And that's WebWorkers. 519 00:35:38,580 --> 00:35:40,600 Really, really powerful stuff. 520 00:35:41,240 --> 00:35:44,680 But, of course, you saw the demo on video. 521 00:35:45,040 --> 00:35:46,440 You saw geolocation. 522 00:35:47,720 --> 00:35:52,060 One other thing I haven't even talked about is what about, you know, the Canvas? 523 00:35:52,540 --> 00:35:56,680 What about browser rendering of 2D and 3D graphics? 524 00:35:57,260 --> 00:36:03,420 What about SVG rendering of, you know, just on the fly SVG rendering? 525 00:36:04,700 --> 00:36:06,560 Well, depends on the browser. 526 00:36:07,140 --> 00:36:07,720 Okay. 527 00:36:07,720 --> 00:36:09,500 Here I'm going to pose a scenario. 528 00:36:09,720 --> 00:36:14,720 A lot of people now using, like, you know, using video, HTML5 video, like YouTube and 529 00:36:15,440 --> 00:36:15,960 Brightcove. 530 00:36:16,220 --> 00:36:18,200 Well, what happens if there are flaws in the codec? 531 00:36:18,520 --> 00:36:19,420 Think about it. 532 00:36:19,780 --> 00:36:20,300 Okay. 533 00:36:23,100 --> 00:36:24,920 Also, this actually works. 534 00:36:25,260 --> 00:36:26,560 You can embed a script. 535 00:36:26,920 --> 00:36:27,440 Okay. 536 00:36:27,760 --> 00:36:31,600 Inside the onError attribute in the audio tag. 537 00:36:34,620 --> 00:36:36,720 Already, I already pointed out. 538 00:36:36,720 --> 00:36:44,420 In the latest bounty hunt by Google Chrome, two of the bugs were found, were specific 539 00:36:44,420 --> 00:36:46,380 to HTML5 features on Chrome. 540 00:36:47,140 --> 00:36:48,420 Well, there's also a heap buffer. 541 00:36:48,660 --> 00:36:54,540 There was a heap buffer overflow by way of the, you know, that, you know, had pertained 542 00:36:54,540 --> 00:36:57,560 to, had everything to do with the HTML5 Canvas in Opera. 543 00:36:58,080 --> 00:36:58,640 Okay. 544 00:36:59,800 --> 00:37:02,080 Also, we all love regular expressions. 545 00:37:02,180 --> 00:37:02,500 Right? 546 00:37:03,320 --> 00:37:05,680 Regular expression for pattern matching. 547 00:37:05,680 --> 00:37:10,560 Well, there's one new attribute in the form field in HTML5, which is called pattern. 548 00:37:10,980 --> 00:37:11,660 All right. 549 00:37:11,720 --> 00:37:13,420 So, you can do client-side validation. 550 00:37:13,820 --> 00:37:16,400 Let's say client-side validation of an email address. 551 00:37:16,920 --> 00:37:17,400 Okay. 552 00:37:17,540 --> 00:37:22,100 An example will be input, and then you feed pattern equal, well, some regex. 553 00:37:23,480 --> 00:37:30,720 What happens, okay, if, for example, your pattern is, like, A star, and, of course, 554 00:37:30,760 --> 00:37:33,460 your value is just a long running stream of As? 555 00:37:34,460 --> 00:37:35,660 Well, there it is. 556 00:37:35,660 --> 00:37:39,400 There is a potential client, there is a potential for regular expression denial of service. 557 00:37:40,180 --> 00:37:40,860 All right. 558 00:37:41,620 --> 00:37:45,060 And, of course, this was actually found in one of the versions of Opera. 559 00:37:45,980 --> 00:37:46,460 Okay. 560 00:37:49,380 --> 00:37:51,240 So, what's the whole story here? 561 00:37:52,080 --> 00:37:57,380 You know, so, in summary, look, HTML5 can do a lot of really, really cool stuff. 562 00:37:57,820 --> 00:38:03,980 You can build full-fledged web applications, all right, and a lot of really groundbreaking, 563 00:38:03,980 --> 00:38:05,300 seminal stuff. 564 00:38:06,120 --> 00:38:13,180 Right now, the only thing that I know that Mozilla is working on a plug-in for taking, 565 00:38:13,700 --> 00:38:22,220 you know, for accessing your camera and your microphone on your device by way of JavaScript, 566 00:38:22,440 --> 00:38:27,180 so there is a potential that you may be able to build chat roulette with HTML5 one day. 567 00:38:27,520 --> 00:38:28,860 But here's the bottom line. 568 00:38:29,220 --> 00:38:29,780 Look. 569 00:38:30,980 --> 00:38:33,440 You know, you can do all these cool things. 570 00:38:33,440 --> 00:38:35,480 But there's two things that really stands out. 571 00:38:36,080 --> 00:38:42,340 Number one, security seems like a complete afterthought, like most of the times, when 572 00:38:42,340 --> 00:38:44,300 they're putting together the HTML5 standard. 573 00:38:45,240 --> 00:38:45,380 Okay. 574 00:38:45,520 --> 00:38:50,840 And the second thing is, a lot of the stuff to really defend yourself, this is not new. 575 00:38:51,320 --> 00:38:51,840 Okay. 576 00:38:51,980 --> 00:38:52,700 It's not news. 577 00:38:53,260 --> 00:39:00,780 Like, for example, how do you actually, you know, the defenses for local storage, web 578 00:39:00,780 --> 00:39:01,140 SQL. 579 00:39:01,540 --> 00:39:02,200 You know. 580 00:39:02,200 --> 00:39:04,040 They're all the stuff that you've heard in the past. 581 00:39:04,560 --> 00:39:04,700 Okay. 582 00:39:05,280 --> 00:39:06,240 Sanitize your data. 583 00:39:06,400 --> 00:39:06,660 You know. 584 00:39:06,700 --> 00:39:08,000 Don't store sensitive information. 585 00:39:08,720 --> 00:39:09,160 Okay. 586 00:39:09,640 --> 00:39:11,200 A lot of the same old problems. 587 00:39:11,420 --> 00:39:14,180 Same old resolution in just a brand-new environment. 588 00:39:16,080 --> 00:39:23,480 Of course, another caveat just to keep in mind is the standard is evolving. 589 00:39:23,680 --> 00:39:24,900 It's changing, like, every day. 590 00:39:25,060 --> 00:39:26,860 So it's even hard for me to keep up. 591 00:39:28,140 --> 00:39:29,900 But why am I giving this talk? 592 00:39:30,420 --> 00:39:30,860 Look. 593 00:39:31,820 --> 00:39:35,040 HTML5, this whole topic of HTML5 is not going away any time soon. 594 00:39:35,800 --> 00:39:36,440 All right. 595 00:39:36,860 --> 00:39:41,500 Now, because of the iPhone and the iPod, you know, all these devices. 596 00:39:42,600 --> 00:39:43,000 Okay. 597 00:39:43,520 --> 00:39:46,200 Because here's the problem if you build mobile applications. 598 00:39:46,940 --> 00:39:49,880 Mobile applications, you're going to use the Android SDK or the iPhone SDK. 599 00:39:50,680 --> 00:39:51,220 All right. 600 00:39:51,240 --> 00:39:52,540 There's a lot of fragmentation issues. 601 00:39:52,780 --> 00:39:55,920 Because if you're going to build a web app, you have to build something directly for using 602 00:39:55,920 --> 00:39:56,720 the Android SDK. 603 00:39:56,940 --> 00:39:58,760 Directly, you know, using the iOS SDK. 604 00:39:59,300 --> 00:39:59,860 All right. 605 00:40:00,380 --> 00:40:06,300 HTML5 is one of the most viable options if you want to have, you know, one environment. 606 00:40:06,480 --> 00:40:08,920 Just one app that can run on everything. 607 00:40:09,520 --> 00:40:10,100 All right. 608 00:40:10,180 --> 00:40:15,240 And a lot of people now know of the problem of segmentation in the mobile app world. 609 00:40:15,560 --> 00:40:16,000 Okay. 610 00:40:16,120 --> 00:40:18,560 So this can't be ignored. 611 00:40:19,360 --> 00:40:21,020 HTML5 just cannot be ignored. 612 00:40:22,060 --> 00:40:22,760 All right. 613 00:40:23,060 --> 00:40:25,220 And it seems like, well, I got some good news. 614 00:40:25,460 --> 00:40:26,660 I got ten minutes left. 615 00:40:26,960 --> 00:40:28,260 And I am done. 616 00:40:28,260 --> 00:40:31,560 Thank you. 617 00:40:31,680 --> 00:40:34,960 All right.