// 示例 HTML 页面
const someHTML = `<!DOCTYPE html>
<!DOCTYPE html>
<html>
<body>
<h1>Hello World</h1>
<p>This is all generated using a DuEdge</p>
<iframe
width="100%"
height="800"
src="https://su.baidu.com"
frameborder="0"
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen
></iframe>
</body>
</html>
`;
async function handleRequest(request) {
const init = {
headers: {
'content-type': 'text/html;charset=UTF-8',
},
};
// 直接返回 HTML 页面
return new Response(someHTML, init);
}
addEventListener('fetch', event => {
return event.respondWith(handleRequest(event.request));
});
直接返回静态页面
暂无讨论,说说你的看法吧