Hot HTML Summer: HTML APIs

A list of tags for this post.

This post is a part of a series where I write a post for each module of the web.dev Learn HTML course. I'll note things I didn't know, highlight interesting items, and generally enjoy having a Hot HTML Summer.

This post covers the HTML APIs module of Learn HTML. Each section below corresponds to a section in this module of the course. The quoted items are relevant passages from the course.

HTML Element APIs

(permalink)

Go to this section at Learn HTML.

The browser provides numerous APIs providing natively supported methods, events, and property querying and updating. Element nodes contain information about all the attributes set on the element. You can use HTML interfaces to access information about an element’s attributes. For example, we can use HTMLImageElement.alt get the alt attributes of all the images.

If I ever get around to properly learning JavaScript all of this going to be really helpful.

Available element interfaces

(permalink)

Go to this section at Learn HTML.

The base interface for all elements is aptly named Element. The HTMLElement inherits from Element and all HTML element-specific interfaces inherit from it. Some element-specific interfaces are implemented by multiple, similar elements.

There’s a list of all the interfaces with links to their respective pages at MDN. I’m adding “Familiarize myself with all the available element interfaces” to my Hot HTML Summer to-do list.

The Window interface

(permalink)

Go to this section at Learn HTML.

Every browser tab contains its own Window object. The Window interface can query the contents of the tab as well as the overall window and device.

What I lack in JavaScript skills I make up for in search engine skills. I’ve been working on archiving an old project and wanted a way to provide a link to the Internet Archive version of a page when there’s a 404.

I landed on using window.location.href to append the page url to the known Internet Archive link that has the entire site to create a “view this page at the Internet Archive” link. Once I validated that it worked I was pretty pleased with myself, and almost felt like I knew JavaScript.

A list of tags for this post.

Enjoying this site? Leave me a tip at Ko-fi!

Back to top