【问题标题】:Detecting installed chrome extensions检测已安装的 chrome 扩展
【发布时间】:2014-06-21 03:56:09
【问题描述】:

我正在尝试检测 chrome 扩展,但我遇到了问题。当我尝试jQuery.load() 时 chrome-extension://jffbcpkfdlpegbadfomimojhgaaoaeed/icon.png 或其他文件,我收到此错误:

Denying load of chrome-extension://jffbcpkfdlpegbadfomimojhgaaoaeed/icon.png. Resources must be listed in the web_accessible_resources manifest key in order to be loaded by pages outside the extension. movie.php?id=3079:1
Failed to load resource: net::ERR_FAILED 

我可以避免使用 web_accessible_resources 吗?我试图将文件名的大小写从 icon.png 更改为 ICON.png 没有成功 (like this)。

这个想法只是为了检测扩展;没有别的。

我想做this之类的事情。

【问题讨论】:

  • 我不明白为什么我有-2?我只是问我不知道做什么,我有什么问题?
  • 你能发布更多你的例子吗?你没有给我们任何东西。
  • Nathing 特别关注THIS link
  • 这是使用不同的扩展 ID。请发布您的完整扩展。

标签: javascript jquery google-chrome google-chrome-extension


【解决方案1】:

如果您需要检测是否安装了扩展程序,对于任何给定的扩展程序,您不应依赖诸如加载 Web 可访问资源(并非对所有扩展程序都适用)之类的技巧,并使用专门提供的 chrome.management API为此目的。

chrome.management.get('keyoftheextensionyouwanttofind', function(info){
  if (!info) { console.log("Extension not installed"); }
  else if (!info.enabled) { console.log("Extension installed, but disabled"); }
  else {console.log("Extension installed and active");}
});

是的,它会trigger a permission warning。

【讨论】:

  • 我不想创建扩展并且我没有扩展,这是 PHP 页面而不是扩展
  • 嗯,这从你的问题中不清楚。对不起。那么,对于你无法控制的扩展,我认为你做不到。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-03-11
  • 2015-01-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多