繁体   English   中英

我如何在chrome扩展程序中嵌入网站

[英]How can i embed a site in a chrome extension pop up

嗨,我正在尝试制作一个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>

任何帮助将非常感激。

亲切的问候

-Sean

首先,您需要在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。

在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM