Reading HTTP-Headers of Web Core Client

Is it possible to get the HTTP-Headers of the client?

i´ve seen the function WEBLib.WebTools.GetQueryParam(AName:string):string. Is there something similar for http-Headers or is this not possible?

1 Like

What exactly do you mean with "HTTP headers of the client"?
Your reference to GetQueryParam seems to indicate you look for the headers the browser uses to request a page? Or is it something else you look for?

Yes i´m looking for the headers which the client is sending with the Request of the page.

I found no evidence that there is a client-side API to get to know the headers the browser is sending for page requests.
Here is information I found about what headers are being sent:
https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending/

Other approach is via a server echo tool

To see the headers your browser is sending to the server when it retrieves a page, you can use JavaScript in combination with a server-side script or a browser's developer tools. Here’s a method using JavaScript with Fetch API and a server-side echo service:

Using JavaScript Fetch with an Echo Service

You can make a fetch request to an echo service that simply returns the headers you sent to it. There are public APIs designed to return the headers sent in a request, such as https://httpbin.org/headers.

Here is how you can do it:

javascript

Copy code

fetch('https://httpbin.org/headers')
  .then(response => response.json())
  .then(data => console.log(data.headers))
  .catch(error => console.error('Error:', error));

Explanation:

  • Fetch API: This is a modern JavaScript API to make network requests similar to XMLHttpRequest.
  • httpbin.org/headers: This service echoes back the headers it received. You can replace this with any server that returns request headers.
  • console.log(data.headers): This prints the headers to the console.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.