1

I have a specific requirement where I can NOT use Angular but only use usual Javascript. When user clicks a href link, javascript should capture the click and add JWT token in http header.

I followed suggestion in below link but it does not solve my issue:

Override default behaviour for link ('a') objects in Javascript

It is possible at all to capture the href clicks and add JWT token to the request.

Another additional questions - How the browser send the href clicks to the server? I know in case of form submission, I can use XHR post to do it. But what mechanism the browser usees to send href clicks to the server.

  • If it's just a navigation to another page you cannot manage it's headers: only url is what you can change. – zerkms Jun 18 '20 at 22:03
  • Thanks.... When I navigate to another page in the browser ( i.e. from Home, I click About Us link), would not the browser send http request to server to load the new page? Can I not capture that browser to server message and change my headers. I saw below link in web: https://igoro.com/archive/what-really-happens-when-you-navigate-to-a-url/ – Suresh Ganapathy Jun 19 '20 at 06:26
  • Browser fully manages the process of navigating to another page, you can only set the url. I don't see anything relevant on that link. – zerkms Jun 19 '20 at 08:47

0 Answers0