Chrome扩展程序执行到外部驱动器文件

时间:2016-06-07 15:32:48

标签: google-chrome google-chrome-extension google-drive-api

我创建了一个扩展,使用executescript api注入一段代码(如下所示),基本上window.onbeforeunload确认他们要关闭页面。我有脚本工作,并使用file://*/*权限,让它注入文件URL。但是,在我下载的flash游戏中进行测试时,脚本没有注入。该网址为externalfile:drive-randomtext/root/SWFNAME.swf。我尝试在权限中添加externalfile://*/*,但收到以下错误消息:There were warnings when trying to install this extension: Permission 'externalfile://*/*' is unknown or URL pattern is malformed.是否有外部文件权限或其他方式执行此操作?

的manifest.json:

{

  "name": "name",
  "short_name": "name",
  "version": "3.6",
  "manifest_version": 2,
  "description": "Desc",
  "permissions": [
     "storage",
     "http://*/",
     "https://*/",
     "tabs",
     "activeTab",
     "webNavigation",
     "*://*/*",
     "file://*/*"
  ],
  "page_action": {
    "default_icon": "logo.png"
  },
  "background": {
     "scripts": ["disabled.js"]
  }

}

执行的脚本:

(热键绑定代码太长,可以找到here

Mousetrap.bind('ctrl+m', function(e) {
  window.onbeforeunload = confirmExit;function confirmExit(){alert('confirm exit is being called');return'Close page?';}
alert('Enabled');
    return false;
});

Mousetrap.bind('ctrl+q', function(e) {
location.reload();
    return false;
});

0 个答案:

没有答案