tencent cloud


Returning an HTML Page

Last updated: 2024-01-25 14:29:07
    In this example, an edge function is used to generate an HTML page, and the HTML page is accessed and previewed from a browser.

    Sample Code

    const html = `
    <!DOCTYPE html>
    <h1>Hello World</h1>
    <p>This markup was generated by TencentCloud Edge Functions.</p>
    async function handleRequest(request) {
    return new Response(html, {
    headers: {
    'content-type': 'text/html; charset=UTF-8',
    'x-edgefunctions-test': 'Welcome to use Edge Functions.',
    addEventListener('fetch', event => {

    Sample Preview

    In the address bar of the browser, enter a URL that matches a trigger rule of the edge function to preview the effect of the sample code.


    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support