Search code examples
javascripthttpheaderhttp-headerstags

JavaScript send custom headers using a script tag only


I want to make a client-side application that loads JavaScript files using only script-tags, (and not fetch, due to cross-origin concerns), but I was wondering if its possible to somehow set the custom request headers in the script tag, such that I can receive only part of a file (the equivalent to sending the range: bytes 10-40 header), or other custom headers the server may request?


Solution

  • No, that's not possible. A script tag will create a regular HTTP GET request without any means to control the headers.