HTML5 vs Flash
Disclaimer: I support the Open Web. I love HTML5. But I also love Flash.
Now that that is out of the way let me take you back 5 years, when Flash was still cool. Remember those amazing interactive websites featured on the FWA website? Running smooth on your browser? We would create an interactive experience and it would work on all browsers. The catch? You needed to install the Flash player which some browsers had it pre-installed.
I remember doing crazy shit and getting 60fps. I would have a full screen background image animating while on the foreground a video player was playing while some particles would animate according to the audio data. Again... at 60fps. I could also have 3D scenes with Papervision3D and have a great performance too.
Fast forward to now. Flash is an outcast, replaced by HTML5. If I need to do crazy stuff I would need to check:
- If I can use CSS property X and Y in all browsers.
- Which video filetype is compatible with all the browsers that I need to support.
- How to force hardware accelerated animations.
- Is canvas supported for doing my particle stuff?
- Is WebGL supported for doing my 3D stuff?
- Is there support for the Web Audio API?
- Make sure that I have a nice fallback when a browser doesn't support all the things that I need to do.
And after I do all that, the experience would still be different in every browser.
But that's fine too. The thing that drives me crazy is that we went from smooth experiences to slower and lagging experiences and we are OK with it. We justify the slowness because it is HTML5. We dropped our expectations.
I'm not saying that it is not possible to get 60fps with HTML5, I'm just saying that we now need to understand how the browser works behind the scenes. When does it repaint? When does it forces a layout? And that is per browser. Because Chrome does things in a specific way, that doesn't mean that Firefox or IE will do it in the same way.
All of the above makes us to have to work more on a project. More work means higher cost. Now, try to explain to a client why it is better to have an HTML5 experience when:
- It will be more expensive for the client.
- It will take more time to build.
- The experience won't be the same on every browser.
I'm not blaming HTML5 for this. I'm blaming the browser vendors. Firefox, Chrome and the others alike are advocating for HTML5. Fine, I agree. But if you are going to start a war against Flash, then make sure to give us at least the same or better experience and performance.
Here are a few reasons why I think Flash is superior than HTML5:
- In Flash when we were animating stuff we didn't have to worry about the redraw regions because Flash was handling that. HTML5 gave us canvas. We now need to handle the redrawing of the regions ourselves. Or use 3rd party libraries (more code to maintain). If we don't do that then our performance will decrease.
- Flash had a great API for drawing.
- You had access to low-level stuff. E.x. you could be messing with bytes.
- AS3 is an Object Oriented programming language with Classical Inheritance.
- And much more...
The craziness of it all
People advocate for HTML5 but they don't like the specs or JS itself and they are using programming languages like CoffeeScript, Dart and TypeScript. Some want OOP inheritance, other want strict types and they have basically created new programming languages that "fix" the things that they don't like. Nicholas Zakas nailed it. He gave an interview at the guys on Nettuts and he said:
Then we get libraries like Johannes Koggdal's oCanvas that provides a nice API for drawing in Canvas. Similar to what we had in Flash.
Another argument against Flash was the whole SEO problem. And it was true. Spiders couldn't read the content inside the Flash file. So developers had to create extra architectures for making the content available for the search engines.
But look at the Internet right now. It is full of HTML5 web apps that take advantage of the History API and the people that were bitching about Flash now shot themselves on the foot. And now these people are creating complex architectures for making their HTML5 web apps SEO friendly.
What that tells me is that we were so eager to ditch Flash but then we replaced it with something inferior that we so hard tried to improve. And we also start doing the same mistakes that we did with Flash (check the SEO argument above).
Final thoughts
I don't want Flash to come back. That's done. It's in the past.
I just hope that people would stop bitching about Flash and recognise how Flash pushed the boundaries and contributed on the evolution of the web.
And finally, I hope that we as developers will push Google, Firefox, Opera etc and demand better and faster browsers.