Browser Functions
Write a function. Get a value. microlink.run() runs your JavaScript in a sandbox — the browser is optional and boots only when your code touches the page.
Overview
Browser optional. Value guaranteed.
microlink.run(url, code) ships a plain function to a remote sandbox — serialization, compression, and the API call are handled for you. Reference page for the full Puppeteer page; skip it and no browser starts at all. See the function parameter.- No page reference → no browser — faster, cheaper compute
- require() any npm package — installed on the fly and cached
- result.isFulfilled stays true even when your code throws
- profiling.phases breaks down install / build / spawn / run
Parameters
What run() forwards.
urlstringTarget page; navigated only when the function reads page.functionstring | FunctionThe code to run remotely — run() serializes it for you.scope optionsobjectExtra options are forwarded into the function scope for reuse.proxyboolean | stringCompose with automatic or BYO proxy for antibot targets.ttlstring | numberCache repeated executions within a freshness window.
Examples
Canonical run() snippets.
Plain compute — Chrome never boots, so it stays fast.
No page, no browser
import createClient from 'microlink.io'
const microlink = createClient({
apiKey: process.env.MICROLINK_API_KEY
})
const { value } = await microlink.run(
'https://example.com',
() => 40 + 2
)
// → 42