2

こんにちは、ブラウザにボタンが表示される Google Chrome 拡張機能を作成しようとしています。クリックすると、このサイトhttp://www.visualbounds.com/Private/XboxMB/Chatbox/でバブル ポップアップが開きます。しかし、私はこれが初めてで、iframe を使用しようとすると、ポップアップに何も表示されません。

どうすればサイトをポップアップに埋め込むことができるのでしょうか?

役立つ場合は、manifest.json を参照してください。

{
  "browser_action": {
    "default_icon": "Images/16.png",
    "default_popup": "popup.html"
  },
   "background": {
      "persistent": false,
      "scripts": [ "background.js" ]
   },
   "content_scripts": [ {
      "js": [ "jquery.js", "script.js" ],
      "matches": [ "https://www.xboxmb.com/*" ],
      "run_at": "document_start"
   },{ "matches": ["http://*/*", "https://*/*" ],
      "all_frames": true,
      "js": ["content.js"]
    }
    ],
   "description": "Chat intergration for XboxMB",
   "icons": {
      "16": "Images/16.png",
      "48": "Images/48.png"
   },
   "manifest_version": 2,
   "name": "XboxMB Chatbox",
   "options_page": "options.html",
   "version": "2.2",
   "permissions": [
        "http://www.visualbounds.com/Private/XboxMB/Chatbox/mobile.html"
    ]
  }

そして、ここに popup.html があります

<!doctype html>
<html>
<head>
    <style type="text/css">
    body {width:200; height:300;}
    </style>
</head>
<body>
    <iframe src="http://www.visualbounds.com/Private/XboxMB/Chatbox/mobile.html" width="100%" height="100%" frameborder="0">
    </iframe>
</body>
</html>

どんな助けでも大歓迎です。

敬具

-ショーン

4

1 に答える 1

1

まず、manifest.json でデフォルトのポップアップ ターゲットを割り当てる必要があります。

{
  "manifest_version": 2,

  "name": "xbox",
  "description": "xbox description",
  "version": "2.2",
  "browser_action": {
    "default_popup": "main.html"
   }
}

そして、iframe要素を挿入するだけです

<iframe src="http://www.visualbounds.com/Private/XboxMB/Chatbox/mobile.html" width="320" height="480"></iframe>

ポップアップ ウィンドウに埋め込まれた iframe が表示されます。

ここに画像の説明を入力

于 2013-10-18T05:50:27.017 に答える