外部iframe是否可以包含在googlechrome扩展中

can an EXTERNAL iframe be included into google chrome extension

本文关键字:googlechrome 扩展 包含 iframe 是否 外部      更新时间:2023-09-26

我指的是这篇文章:

http://julip.co/2010/01/how-to-build-a-chrome-extension-part-3-loading-any-web-page-in-a-popup/

<html>
<head>
    <style type="text/css">
    body {width:200; height:300;}
    </style>
</head>
<body>
    <iframe src="http://m.bing.com" width="100%" height="100%" frameborder="0">
    </iframe>
</body>
</html>

此扩展的源代码为:http://mfi.re/?imwxngtdkhg

然而,它并没有显示任何东西。

我的问题是:EXTERNAL iframe是否可以包含在google chrome扩展中

是的,您可以在弹出窗口中显示iframe。它有点重,我不建议你这样做,但你可以。

您链接的扩展名的问题是manifest.json文件格式错误:

  • "manifest_version"参数不存在,应将其设置为2
  • 浏览器操作的默认弹出窗口是使用"default_popup"定义的,而您使用的是"popup",这是错误的

这是正确的manifest.json文件:

{
    "manifest_version": 2,
    "name": "Mini Bing Search",
    "description": "Search Bing right from your browser without leaving your current page.",
    "version": "0.1",
    "browser_action": {
        "default_icon": "icon19.png",
        "default_popup": "popup.html"
    },
    "icons": { 
        "48": "icon48.png",
        "128": "icon128.png" 
    }
}

在此处下载工作示例