Chrome不允许向允许的域发送Ajax请求 [英] Chrome not allowing Ajax request to permitted domains

查看:139
本文介绍了Chrome不允许向允许的域发送Ajax请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建我的第一个Chrome扩展程序,这是一个相对简单的扩展程序,带有一些Ajax调用。

I'm creating my first Chrome extension, a relatively simple one with some ajax calls.

我的清单很简单:

My manifest is pretty simple:

{
    "name": "Read It Now",
    "version": "0.12",
    "description": "Read it now.",
    "permissions": [
                    "https://readitlaterlist.com"
                   ],
  "app": {
      "launch": {
          "local_path": "index.html"
      }
  }
}

然后我使用jQuery获取一些简单来自以下网址的数据:

I'm then using jQuery to fetch some simple data from a URL like:

https://readitlaterlist.com/v2/get?state=unread&count=10&apikey=xxx&username=yyy&password=zzz

然而,Chrome仍然拒绝它:

However, Chrome still rejects it:


XMLHttpRequest无法加载
https://readitlaterlist.com/v2/get?state=unread&count=10&apikey=xxx&username=yy Y'安培;密码= ZZZ
Origin chrome-extension:// cdfeahailioembamnjnikbiemengfgpp不是
允许的Access-Control-Allow-Origin。

XMLHttpRequest cannot load https://readitlaterlist.com/v2/get?state=unread&count=10&apikey=xxx&username=yyy&password=zzz. Origin chrome-extension://cdfeahailioembamnjnikbiemengfgpp is not allowed by Access-Control-Allow-Origin.


推荐答案

您必须在 URL匹配中包含路径格式https://readitlaterlist.com/*应该解决您的问题。

You have to include the path in your URL match pattern. "https://readitlaterlist.com/*" should fix your problem.

这篇关于Chrome不允许向允许的域发送Ajax请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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