简体   繁体   English

Google Chrome扩展程序错误 - 访问控制 - 允许 - 来源

[英]Google Chrome Extension error - Access-Control-Allow-Origin

XMLHttpRequest cannot load http://localhost:4567/save . XMLHttpRequest无法加载http:// localhost:4567 / save Origin chrome-extension://cbemaelkkmebiohhjgmlclegalijdbbh is not allowed by Access-Control-Allow-Origin. 原始chrome-extension:// cbemaelkkmebiohhjgmlclegalijdbbh不允许使用Access-Control-Allow-Origin。

Even thought I'm getting this error the extension seems to be calling the URL. 即使我认为我收到此错误,扩展似乎是调用URL。 The message passing from contentscript.js to background.html took me a few minutes to wire up, but seems ok. 从contentscript.js传递到background.html的消息花了我几分钟接线,但似乎没问题。 I'm confused. 我糊涂了。

Here is my manifest. 这是我的清单。

{
  "name": "FirstExt",
  "version": "1.0",
  "description": "My First Extension",
  "browser_action": {
    "default_icon": "icon.png",
    "popup": "popup.html"
  },
  "content_scripts": [
  {
    "matches": ["http://*"],
    "js": ["jquery.min.js", "contentscript.js"]
  }
  ],
  "background_page": "background.html",
  "permissions": [ "http://*", 
               "http://localhost:4567/*" ]
}

Try changing http://* to http://*/ (and removing the localhost entry). 尝试将http:// *更改为http:// * /(并删除localhost条目)。

If you're trying to access a https page, you will need that too. 如果您尝试访问https页面,也需要这样做。

"http://*"替换为"<all_urls>"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Chrome扩展程序中的Access-Control-Allow-Origin错误 - Access-Control-Allow-Origin error in a chrome extension Chrome 中的 Access-Control-Allow-Origin 错误 - Access-Control-Allow-Origin error in Chrome Access-Control-Allow-Origin不允许“Chrome扩展程序”的含义? - Meaning of “Chrome-extension is not allowed by Access-Control-Allow-Origin”? Chrome扩展程序-Access-Control-Allow-Origin不允许使用 - Chrome Extension - Not allowed by Access-Control-Allow-Origin “尝试与Chrome扩展程序中的Google Contacts API进行交互时,不会出现”Access-Control-Allow-Origin“标题 - “No 'Access-Control-Allow-Origin' header is present” when trying to interact with Google Contacts API from Chrome extension Chrome扩展程序后台页面有时会返回错误Access-Control-Allow-Origin(通常在Windows XP上) - Chrome Extension background page returns error Access-Control-Allow-Origin only sometimes (usually on Windows XP) 谷歌日历的访问控制-允许-起源 - Access-Control-Allow-Origin google calendar Access-Control-Allow-Origin不允许使用Chrome Origin null - Chrome Origin null is not allowed by Access-Control-Allow-Origin Chrome 上的 access-control-allow-origin 不允许 Origin null - Origin null is not allowed by access-control-allow-origin on Chrome Chrome扩展程序20小时后没有“Access-Control-Allow-Origin”标题 - Chrome extension No 'Access-Control-Allow-Origin' header after 20 hours
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM