铬扩展 - IP域的权限 [英] chrome extension - ip domain permissions

查看:108
本文介绍了铬扩展 - IP域的权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Chrome扩展需要将请求发送到我的家庭局域网上的服务器,在那里我没有DNS设置,所以我使用原始IP的一切。我通过我的背景页面发送这些请求,所以在清单文件中具有适当的权限时,应该让我这样做。这是我在清单中:

My chrome extension needs to send requests to a server on my home LAN, where I don't have DNS setup, so I'm using raw IP's with everything. I'm sending these requests via my background page, so with proper permissions in the manifest file it should let me do it. This is what I have in the manifest:

"permissions": [
    "http://10.0.0.4:3000/*","http://*/*"
]

然而,与http嗅探器,我看到没有请求发送到该目的地。通过日志记录,我看到jQuery $。ajax()调用已到达:

However with the http sniffer I see that no requests are sent out to that destination. via logging I see that the jQuery $.ajax() call is reached:

$.ajax({ url: url,
         type: 'POST',
         timeout: 500,
         context: document.body,
         success: function(){} });

我读过这个线程,它指示我从后台页面发出http请求。

I've read this thread, which directed me to make http requests from the background page.

问题:你们认为使用原始IP会导致请求被Chrome删除吗?

Question: do you guys think that using raw IPs is causing the request to be dropped by chrome?

谢谢。

推荐答案

不,使用原始IP不是问题。我试图通过具有通用权限的扩展名( http:// * / * )从IP中获取我的路由器页面,并且它工作正常。尽管有两个关于你的代码的提示:

No, using raw IPs is not the problem. I just tried getting my router's page through its IP from an extension with universal permissions (http://*/*) and it worked fine. Two notes about your code though:


  1. 你正在做一个POST,但没有指定任何数据。我不确定这是否合法。

  2. 您的示例中缺少右大括号。我编辑它,假设它是一个错字,但也许这就是问题所在。

这篇关于铬扩展 - IP域的权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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