Riff / Built on the open web / Platform

Navigation Timing

Tells a reload from a link, so a reload never autoplays.

A post with its tracks listed, and the player bar along the bottom of the screen
Arriving here from a link resumes the music; a reload shows the bar paused at the same spot.

How Riff uses it

When restoring the saved state, the script reads the type of the navigation entry. After a reload the saved track loads at its position but stays paused. After a link, a track that was playing resumes.

Why

The click that follows a link is the gesture the new page needs to play with sound. A reload has no such gesture and would be blocked or surprise the listener.

Without it

The entry is optionally chained, so without one the saved playing flag decides alone.

Where

Links open the source at the commit this page was published from.

Reference: Navigation Timing on MDN.