# Browser examples — `posprintUrl()`
See [docs/POSPRINT-URL.md](../../docs/POSPRINT-URL.md) for URL format and size limits.
Browsers cannot read arbitrary paths on disk. “Local file” here means a user-selected `.pos` file via ``, or JSON fetched from your server.
Requires `CompressionStream('deflate-raw')` (recent Chromium, Firefox, Safari).
```html
```
## From an object
Build the document in JavaScript and open the link:
```html
```
Or render a link without navigating immediately:
```js
const url = await posprintUrl({ /* … */ });
const a = document.createElement('a');
a.href = url;
a.textContent = 'Print receipt';
document.body.append(a);
```
## From a local `.pos` file (user picks file)
```html
Print
```
## From a file on your server
If the `.pos` lives on the same site, fetch it and pass the JSON string:
```js
const res = await fetch('/templates/receipt.pos');
const json = await res.text();
const url = await posprintUrl(json);
window.location.href = url;
```
## Length warning
On Windows, keep the full URL under ~7000 characters so the OS can launch posprint. Prefer short templates and `@image https://…` for logos.