什么是说“无javascript”的常用方式?在请求头中? [英] What is the common way to say "no javascript" in the request header?
问题描述
我想告诉服务器浏览器不支持javascript。
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?)
推荐答案
HTTP协议没有定义任何这样的头文件。所以你可以使用一个自定义的。像:
The HTTP protocol doesn't define any such header. So you could use a custom one. Like:
X-JAVASCRIPT-ENABLED: false
但当然你也可以使用任何你喜欢的其他头文件。顺便问一下,为什么服务器会关心客户端是否支持javascript?我的意思是这是客户的责任。 < noscript>
标记是向不支持javascript的客户端提供替代内容的好方法。
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.
这篇关于什么是说“无javascript”的常用方式?在请求头中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!