window, location, history & navigator in JavaScript
Beyond the DOM sits the BOM (Browser Object Model): window (globals, sizing, dialogs, open/close), location (URL parts plus assign/replace/reload navigation), history (back/forward/go plus pushState for SPA routing), and navigator (language, onLine, clipboard, geolocation behind permissions).
location.assign navigates keeping history; replace swaps without an entry (login redirects); reload refreshes (true once forced server). history.pushState plus popstate handling implements client-side routing β the SPA navigation contract in two APIs.
window hosts globals
Dimensions (innerWidth/Height), dialogs (alert/confirm β blocking, avoid), open/close, and every global binding.
location navigates
location.href reads/sets the URL; assign() keeps history, replace() swaps it, reload() refreshes.
history routes SPAs
pushState({}, "", "/page") changes URL without loading; popstate events drive back/forward handling.
navigator describes
language, onLine, clipboard (async, permissioned), geolocation (permissioned) β capability and context APIs.
console.log(location.hostname);history.pushState({}, "", "/learn");console.log(location.pathname);Recommended resourcesAffiliate links Β· may earn us a commission
Recommended for learners
Practice what you learned
Re-implement each visualized algorithm in JavaScript yourself β building beats watching.