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="">
1
A
回答
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.
相關問題
- 1. 的iOS WKWebview不響應點擊<a href="javascript:doSomething()" ...></a>
- 2. <a href ></a>不會對單一的點擊
- 3. <a href=""></a>不工作
- 4. jQuery來提取 '點擊我' 從<a href="http://example.com">Click Me</a>
- 5. 防止屏幕在點擊時移動<a href=></a>
- 6. <a href=...> syntax
- 7. <a href="#!"> do?
- 8. <a href="link.html">
- 9. 頁面跳轉點擊<a href> tag in IE, jquery is attached to the a href
- 10. 當我點擊<a>
- 11. href表達式<a href="javascript:;"></a>做什麼?
- 12. 什麼是<a href="?request=register"> Register</a>中的href?
- 13. 無法點擊一個href的值(<a href="#" data-bind="click: $root.lnkAdd">New Grade</a>)
- 14. In標籤<a href="....."></a></td>查詢中的DOUBLE_WHITESPCE href
- 15. PHP <a href =點擊值到cookie
- 16. jQuery - target.href與<a href="#"><img></a>
- 17. 點擊<tr>,但只有當點擊不是<a>
- 18. HTML,防止<a HREF的點擊= "#">從改變URI
- 19. 避免瀏覽器點擊<a href="#divID">
- 20. 防止鏈路<a>沒有HREF從點擊
- 21. 點擊<a href="#">時不想去頁首
- 22. 避免jQuery的點擊功能上<a href=""> elements
- 23. Bootstrap翻轉div點擊<a href> does not work on mobile
- 24. 硒:<a>標記與HREF點擊行爲錯誤
- 25. 如何讓<a> HREF有一個「已經點擊」風格
- 26. PHP點擊後<a href> content in text file is deleted
- 27. CSS和<a href> issue
- 28. <a href="#..."> link not working
- 29. @ Html.ActionLink到<a href="@Url.Action()>
- 30. 使用<a href= > tag
Why? What's the use-case for this? –
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
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 在客戶端瀏覽器請求中添加授權頭,檢查用戶是否被授權。 –