2017-06-08 431 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.點擊<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 在客戶端瀏覽器請求中添加授權頭,檢查用戶是否被授權。 –

回答

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.

相關問題