Synchronously loads content from a URL and returns a response object.
loadURL(url, options?)
url
A string containing the URL to fetch.
options optional
An object containing request options (currently unused).
A URLResponse object containing the response data and metadata.
url
The final URL (after redirects).
status
The HTTP status code.
headers
An object containing the response headers.
body
A Blob containing the response body data.
Returns the response body as a string.
Parses the response body as JSON and returns the resulting object.
Returns the response body as an ArrayBuffer.
// Load a web page
let response = loadURL("https://httpbin.org/get")
let data = response.json()
data.url
"https://httpbin.org/get"
// Check status
let response = loadURL("https://example.com/api/data")
response.status
404
// Access headers
let response = loadURL("https://httpbin.org/headers")
response.headers["Content-Type"]
"application/json"