我如何设置网页上链接的Accept Header? [英] How can I set the Accept Header for a link on a web page?

查看:238
本文介绍了我如何设置网页上链接的Accept Header?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这主要是一个象牙塔的问题,因为我可以轻松制作一个新的URL端点。但基本上,我希望能够在用户将Accept头配置为包含text / csv时提供CSV。这在服务器端是微不足道的,但在客户端,我不知道如何设置Accept头,除非我使用XHR或其他非浏览器客户端。有没有一种方法可以在HTML中设置一个链接中的Accept头或者在使用window.location时设置Accept头的方法?

This is mostly an ivory tower question, since I can easily just make a new URL endpoint. But basically, I'd like to be able to serve up CSV when the user has the Accept header configured to include text/csv. That's trivial on the server side, but on the client side I don't know how to set the Accept header unless I'm using XHR or some other "non-browser" client. Is there a way in HTML to set the Accept header in a link or in JS to set the Accept header when using window.location?

推荐答案

我想我可能会把这个放在这里,供下一千个人看这个帖子。你做不到。

I figure I might as well put this here for the next thousand people looking at the post. You cannot do it.

这篇关于我如何设置网页上链接的Accept Header?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆