The rising global popularity of smart phones and other small-screen Internet devices has created a number of dilemmas for web developers. Among the most pressing is the issue of serving the proper image files for widely divergent screen sizes. The industry has responded with a variety of solutions, including separate mobile websites that are much leaner in terms of shown images. A new attribute, <img srcset>, has the potential to resolve some of the issues by enabling the desired image size,...
This is the second part in our introduction to HTML5's video API. In part 1 of this series, I introduced you to the basic markup we'll be using to play the video, then I helped set up a simple script with which we were able to make the controls visible, while ensuring that the native controls will still be visible when JavaScript is disabled. We also touched on the use of JavaScript's addEventListener method, along with our first look at the video API -- the canplaythrough event. Let's dig a little deeper into...