tencent cloud

Feedback

Fetch Remote Resources

Last updated: 2024-01-25 14:21:18
    In this example, the Fetch API is called to fetch a remote jQuery.js resource and send the resource to a client in response to a request from the client.

    Sample Code

    async function handleRequest(request) {
    // Fetch a remote resource.
    const response = await fetch('https://static.cloudcachetci.com/qcloud/main/scripts/release/common/vendors/jquery-3.2.1.min.js');
    return response;
    }
    
    addEventListener('fetch', event => {
    return event.respondWith(handleRequest(event.request));
    });

    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.
    

    References

    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