Design Browser History

Medium · Stack & Monotonic Stack · about 15 minutes

Asked at Bloomberg, Amazon, Snowflake, Roblox, Apple.

A browser has one tab starting at homepage.

  • BrowserHistory(homepage) opens the homepage.
  • visit(url) visits url from the current page and clears all forward history.
  • back(steps) moves back up to steps pages and returns the current url.
  • forward(steps) moves forward up to steps pages and returns the current url.