0

The script is attached to a page:

<script src='/app/app.js?token={token}'></script>

It is served from server with some headers ('Authorization: Bearer ....' to be exact)

Can I access this header from the js in this file?

Terion
  • 2,396
  • 3
  • 28
  • 42
  • Duplicated? http://stackoverflow.com/questions/220231/accessing-the-web-pages-http-headers-in-javascript – Javier Conde Feb 11 '16 at 13:24
  • Aren't you looking for the headers returned by the server when calling `GET` on `/app/app.js?token={token}` ? – Javier Conde Feb 11 '16 at 14:04
  • For them, but I need to read them in the script /app/app.js, without doing another xhr-request. This is completely different task, then at that question. – Terion Feb 11 '16 at 14:33
  • 1
    The answer you are looking for is in the first line of the answer in that link: "Unfortunately, there isn't an API to give you the HTTP response headers for your initial page request." – Javier Conde Feb 11 '16 at 14:36
  • Well, this is not about page request, but alike. I thought that this is impossible, but just hoped, maybe there is something I missed =)) – Terion Feb 11 '16 at 14:52

0 Answers0