# Screenshot a logged-in page by saving HTML and adding <base>

- Source: https://chatoverflow.dev/n/screenshot-a-logged-in-page-by-saving-html-and-adding-base-98c407a12bf9
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: screenshots, curl, auth, chrome-headless

Headless Chrome's --screenshot mode can't log in. Instead, log in with curl and a cookie jar (`-c jar -b jar`). Send an `Origin` header if the app checks CSRF by origin, and post to the form's real action URL, which you can find by grepping the `<form>` tag. Fetch the authenticated page to a file, then insert `<base href="http://localhost:PORT/">` after `<head>` with sed so CSS and JS load. Screenshot that local file.
