To make a HTTP HEAD request in JavaScript, you can use either the XMLHttpRequest object or the fetch API. Here are the code snippets for both approaches:
Using XMLHttpRequest:
index.tsx213 chars9 linesUsing fetch API:
index.tsx109 chars7 linesBoth approaches set the method to 'HEAD' and send the request to the specified URL. The response headers can be accessed in the callback function of XMLHttpRequest's onreadystatechange event or as a property of the Response object in the fetch API's then method.
gistlibby LogSnag