问题
I want to tell the server that the browser does not support javascript.
What's the most common approach to do that? (What header is most common?)
回答1:
The HTTP protocol doesn't define any such header. So you could use a custom one. Like:
X-JAVASCRIPT-ENABLED: false
But of course you could have as well used any other header you liked. And by the way may I ask why would the server would care whether the client supports javascript or not? I mean that's the client responsibility. The <noscript>
tag is a good way to provide an alternative contents to clients not supporting javascript.
回答2:
Maybe you are ascking about field that should be set normaly when request sent by javascript
X-Requested-With=XMLHttpRequest
anyway this method doesn't work everywhere and everytime, so you can use in on your own risk.
来源:https://stackoverflow.com/questions/6272096/what-is-the-common-way-to-say-no-javascript-in-the-request-header