从扩展页面访问Cast API

时间:2013-08-10 01:21:46

标签: google-chrome google-chrome-extension google-cast

我正在开发一个chromecast应用,我想将它整合到chrome扩展中。我也使用knockout.js来帮助一些UI。我有两个页面,一个是未取消装箱的(http://jsfiddle.net/AuJaX/3/),另一个是沙箱(http://jsfiddle.net/V2dJc/1/)。没有一个console.log被调用。我的清单如下:

{
  "manifest_version": 2,
  "name": "__MSG_app_title__",
  "description": "__MSG_app_description__",
  "version": "0.1",
  "content_scripts": [
    {
  "matches": ["<all_urls>"],
      "js": ["js/content/content.js"]
    }
  ],
  "background": {
    "scripts": ["js/back/background.js"],
    "persistent": false
  },
  "permissions": [
    "tabs",
    "contextMenus"
  ],
  "page_action": {
    "default_title": "__MSG_app_title__",
    "default_icon": {
      "19": "images/icon-19.png"
    }
  },
  "sandbox": {
    "pages": ["sandboxed.html"]
  },
  "icons": { "48": "images/icon.png" },
  "default_locale": "en"
}

有什么我做错了,或者这是不支持的东西(还是??)?

1 个答案:

答案 0 :(得分:3)

您是否将要尝试使用该扩展程序的域列入白名单?目前要将Cast API注入页面,您需要做两件事:

<html data-cast-api-enabled="true">

您需要按照本页底部的步骤进行操作(在扩展程序中列入白名单,与Google Cast设备白名单不同):

https://developers.google.com/cast/whitelisting#whitelist-chrome

那就是说,我怀疑这会起作用。说明用于将Cast API注入常规网页。但是,如果我没弄错的话,您需要将API注入Chrome扩展程序页面。我不知道它是否会在那里提供,因为我不认为允许两个不同的扩展进行交互。

相关问题