Skip to content
Visit Workers on GitHub
Set theme to dark (⇧+D)

Return small HTML page

Deliver an HTML page from an HTML string directly inside the Worker script.

const html = `<!DOCTYPE html>
<h1>Hello World</h1>
<p>This markup was generated by a Cloudflare Worker.</p>
async function handleRequest(request) {
return new Response(html, {
headers: {
"content-type": "text/html;charset=UTF-8",
addEventListener("fetch", event => {
return event.respondWith(handleRequest(event.request))


Open demo