# What is headless browser scraping?

Headless browser scraping loads a page in a real browser with no visible window, runs its JavaScript, and then extracts the rendered content.

Headless browser scraping uses a real web browser running without a visible window, controlled by a program through a browser automation library, to load a page, execute its JavaScript, and then extract the fully rendered content. It is needed for sites that build their pages in the browser, where a plain HTTP request returns an empty shell.

## Why a plain HTTP request sometimes isn't enough

A simple scraper sends an HTTP GET and parses the HTML that comes back. That works for pages rendered on the server. But many modern sites are single-page applications: they send a nearly empty HTML document plus a bundle of JavaScript, and the content only exists after that JavaScript runs. Fetch such a page without a browser and you get an empty container element and a loading indicator.

A headless browser closes that gap. It is a full browser engine that runs without drawing to a screen, driven by an automation protocol. It executes scripts, makes the page's own API calls, waits for content to appear, and can click, scroll and fill in forms. Everything a person's browser does, it does under program control.

## The trade-offs

Rendering is powerful but expensive, which is why it is not the default everywhere:

- **Speed.** A rendered fetch often takes seconds where a plain request takes a fraction of a second.
- **Cost.** Each browser instance uses real CPU and memory, and many of them need orchestration.
- **Fragility.** Timing problems, such as content that loads after your extraction runs, are a constant source of flaky results.
- **Access.** Some sites detect automated browsers and refuse them. A site's terms and its [robots.txt](https://millionshort.com/docs/glossary/what-is-robots-txt) still apply to a browser that a program drives.

The usual engineering answer is selective rendering: try the cheap static fetch first, and fall back to a browser only when the page needs it.

## Headless browsers in AI data pipelines

For LLM workloads, rendering is a means and not the end. The rendered page still has to be cleaned and converted before a model can use it, as covered in [what a web scraping API does](https://millionshort.com/docs/glossary/what-is-a-web-scraping-api) and [HTML to markdown conversion](https://millionshort.com/docs/glossary/what-is-html-to-markdown). Managed extraction services bundle the whole chain, so that rendering becomes an option on a request instead of infrastructure you run.

Many questions do not need a browser at all. If what you need is to find pages and read a passage from each, a [web search API](https://millionshort.com/docs/glossary/what-is-a-web-search-api) answers from an index that was built ahead of time.

## Where MillionShort fits

MillionShort does not offer a headless browser or browser automation. A search returns results with text snippets, and your code never loads a page. When you need one page's text, [Extract](https://millionshort.com/docs/extract/parameters) turns a URL into clean text; its `rendered` mode loads the page in a browser first, so content built by scripts appears.
