What is the common way to say “no javascript” in t

2019-06-20 21:45发布

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?)

2条回答
叼着烟拽天下
2楼-- · 2019-06-20 22:38

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.

查看更多
Lonely孤独者°
3楼-- · 2019-06-20 22:46

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.

查看更多
登录 后发表回答