2017-06-08 1 views
1

I would like to add 'authorization' header in each client request made with browser on click of Some Link. And these requests are not ajax based.
For example,
When I access 'domain/sample' directly through URL bar, the 'authorization' header should not set. But when I'm click , the 'authorization' header should set with some value. And I would like to do it with basic HTML, Javascript, and Jquery.Berechtigungsheader in der Client-Browser-Anfrage hinzufügen, wenn Sie auf <a href="">

+0

Why? What's the use-case for this? –

+0

Welcome to SO! Please read ["What topics can I ask about here?"](http://stackoverflow.com/help/on-topic) and show what you've tried so we can help. – Darren

+0

Actually, I'm using Laravel passport for authorization. And I've to check where the user is authorized with laravel passport to achieve some functionality. Laravel Passport will check for 'Authorization' => 'Bearer '.$accessToken header to authorize the user. So, I have to add authorization header in each client made through the click of klicken, um zu prüfen, ob der Benutzer berechtigt ist. –

Antwort

1

This cannot be accomplished with HTML, JavaScript or JQuery.

HTTP headers are sent long before HTML is parsed or rendered, let alone running scripts.

You can send authorisation headers from the server configuration (.htaccess, etc.) or from a script running at the server, like PHP.

Verwandte Themen