【问题标题】:can an EXTERNAL iframe be included into google chrome extension可以将外部 iframe 包含在 google chrome 扩展中吗
【发布时间】:2014-10-17 11:19:27
【问题描述】:

我参考这篇文章:

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

但是它并没有显示任何内容。

我的问题是:可以将外部 iframe 包含在 google chrome 扩展中吗?

【问题讨论】:

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


    【解决方案1】:

    是的,您可以在弹出窗口中显示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" 
        }
    }
    

    下载工作示例HERE

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-05-28
      • 1970-01-01
      • 1970-01-01
      • 2011-11-12
      • 1970-01-01
      • 2013-09-10
      • 1970-01-01
      相关资源
      最近更新 更多