yarek
yarek

Reputation: 12034

can an EXTERNAL iframe be included into google chrome extension

I refer to this article:

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>

Source code of this extension is: http://mfi.re/?imwxngtdkhg

Howver it does not dispaly ANYTHING.

My question is: can an EXTERNAL iframe be included into google chrome extension ?

Upvotes: 2

Views: 493

Answers (1)

Marco Bonelli
Marco Bonelli

Reputation: 69276

Yes, you can display an iframe inside a popup. It's a bit heavy and I don't recommend doing it, but you can.

The problem with the extension you linked is that the manifest.json file is malformed:

  • The "manifest_version" parameter is absent, and it should be set to 2.
  • The default popup of the browser action is defined using "default_popup", and you are using "popup" instead, which is wrong.

Here is the correct manifest.json file:

{
    "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" 
    }
}

DOWNLOAD A WORKING EXAMPLE HERE

Upvotes: 2

Related Questions