The Modern Web: Device APIs

This is an edited excerpt from Chapter 6 of The Modern Web by Peter Gasston. You can download the source files to go with the code examples here

In the previous chapters, I’ve discussed some of the many APIs that have been introduced as part of the HTML5 process, such as microdata and Touch Events. But there is a further range of APIs that, although not part of the spec, are certainly related; and these APIs offer something extremely attractive to developers in the multi-screen world: access to the device itself. In this chapter, we take a look at some device APIs—from the new location and spatial features in portable devices to file and storage optionsacross most modern browsers. Obviously not all APIs are going to be available on every device—knowing the position in three-dimensional (3-D) space of a television is of little practical use—but many APIs are useful across a broad range of user agents.

This is a curated list of those APIs I feel will be most practical, and the introductions to many are, for reasons of space, quite brief; often, the APIs will be much more extensive, and although I’ll note where I think the scope is available for you to learn more, I urge you to discover for yourself the capabilities and possibilities of accessing the device through JavaScript.

Thank you for reading 5 articles this month* Join now for unlimited access

Enjoy your first month for just £1 / $1 / €1

*Read 5 free articles per month without a subscription

Join now for unlimited access

Try first month for just £1 / $1 / €1

TOPICS

The Creative Bloq team is made up of a group of design fans, and has changed and evolved since Creative Bloq began back in 2012. The current website team consists of eight full-time members of staff: Editor Georgia Coggan, Deputy Editor Rosie Hilder, Ecommerce Editor Beren Neale, Senior News Editor Daniel Piper, Editor, Digital Art and 3D Ian Dean, Tech Reviews Editor Erlingur Einarsson and Ecommerce Writer Beth Nicholls and Staff Writer Natalie Fear, as well as a roster of freelancers from around the world. The 3D World and ImagineFX magazine teams also pitch in, ensuring that content from 3D World and ImagineFX is represented on Creative Bloq. 

Latest in Web Design
A screenshot of the new YouTube UI
Yes, YouTube has a new UI. Yes, it's terrible
Adobe XD logo
It seems Adobe's given up on UI design (for now)
Adobe Muse
Why Adobe is frustrating web designers
Dropbox Relay interface with photo of man running
How Dropbox Replay is helping designers future-proof their practice
UX revolution
From 2D to 3D: How brands can harness the latest UX/UI revolution
Personal portfolio of Julie Bonnemoy with a retro vibe
From AI to no-code: The top web design trends for 2024 according to Designmodo
Latest in Features
Selection of Guinness ads throughout the ages
The best Guinness adverts of all time – from the toucan to a singing pint
Tina Touli headshot
"The 9 to 5 work routine was draining my creativity”: a day in the life of Tina Touli
Promise Mascot Agency;
How Ikumi Nakamura's 'art bible' helped create Promise Mascot Agency's grotesque mascots, and why collaboration in indie game development is vital
Stanley 'Artgerm' Lau discuses AI; a digital illustration showcases a stylised female figure, reminiscent of a comic book superhero, likely Supergirl, with vibrant colours and a dynamic pose
"In the future, there will be fewer artists like me – real artists" says Stanley 'Artgerm' Lau as he reflects on the dangerous impact of AI on art
Pittura, a short film made at ArtFX
"We wanted to talk about AI and its relationship to art" – how we made 2025’s VES Student Award-winning animation Pittura
Stanley 'Artgerm' Lau; a vibrant, dynamic illustration showcases Spider-Gwen in a dynamic action pose amidst a cityscape, radiating a sense of energy and playful confidence
"Art is not easy. You have to suffer in joy" – Stanley 'Artgerm' Lau reflects on what it takes to succeed in comic art