设置“不安全"打包的应用程序XHR中的标题 [英] Setting "unsafe" headers in packaged app XHR

查看:60
本文介绍了设置“不安全"打包的应用程序XHR中的标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在打包的应用程序中的XHR请求中修改User-Agent标头.这样做时,我得到了错误:

I need to modify the User-Agent header in an XHR request in my packaged app. When I do so, I get the error:

拒绝设置不安全的标头"User-Agent"

Refused to set unsafe header "User-Agent"

我的应用程序已经具有完全的套接字访问权限,所以我可以这样做.但这真的很烦人.

My app already has full socket access, so I could do it that way. But that would be really, really annoying.

如果允许我在已经具有原始套接字访问权限的打包应用程序中设置此标头,那就太好了.

It would be super nice if I were allowed to set this header in packaged apps that already have raw socket access.

也许我不知道其他一些API或权限? webRequest在这里似乎无关紧要.

Maybe there is some other API or permission that I'm not aware of? webRequest doesn't seem to be relevant here.

推荐答案

似乎不太可能在Chrome平台上解决.因此,当我需要对我的XMLHttpRequest进行更多控制时,我使用自己的填充程序,该填充程序在用于Chrome浏览器的Web服务器(github)项目.您可以在示例中看到它的使用

It seems unlikely that this will be addressed on the Chrome platform. So when I need to have more control over my XMLHttpRequest, I use my own shim, which I am keeping up to date inside the Web Server for Chrome (github) project. You can see it being used in this example

这篇关于设置“不安全"打包的应用程序XHR中的标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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