fileName parameter in the request URL. addEventListener('fetch', event => {event.passThroughOnException();event.respondWith(handleRequest(event.request));});async function handleRequest(request) {const url = new URL(request.url);const fileName = url.searchParams.get('fileName');const response = await fetch(request);// Evaluate the response status code and the search parameterif (response.status !== 200 || !fileName) {return response;}// Modify the Content-Disposition response headerresponse.headers.append('Content-Disposition', `attachment; filename="${fileName}"`);return response;}
https://example.com/origin.exe?fileName=modified.exe) that matches the trigger rule of edge function in the address bar of the browser on both the PC and mobile terminal to preview the example effect.
Esta página foi útil?
Você também pode entrar em contato com a Equipe de vendas ou Enviar um tíquete em caso de ajuda.
comentários