我已经创建了一个铬的扩展,这是一个聊天室的扩展。我需要它像这个粘条镀铬扩展一样贴在屏幕上
下面是它的外观:点击这里获取图像
我在popup.html文件中使用了以下代码:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Chat Adda</title>
<style>
body{}
.resize{min-width:640px; min-height:480px; resize:both; overflow: auto;}
.row{background-color:#5cbf2a;text-align:center;padding:5px 10px 5px 10px;}
</style>
</head>
<body>
<div class="resize">
<iframe id="theFrame" src="http://chatadda.com" style="width:100%;height:100%;" frameborder="0"></iframe>
<div class="row">
<span><a href="http://chatadda.com" target="_blank"><img src="/open.png" width="32px" height="32px"/></a></span>
<span><a href="https://play.google.com/store/apps/details?id=com.chatadda.android&hl=en" target="_blank"><img src="/android.png" width="32px" height="32px"/></a></span>
<span><a href="https://www.facebook.com/sharer/sharer.php?u=http%3A//chatadda.com/" target="_blank"><img src="/facebook.png" width="32px" height="32px"/></a></span>
<span><a href="https://twitter.com/home?status=ChatAdda.com%20-%20Chat,%20flirt,%20date%20and%20make%20new%20friends.%20Chat%20with%20strangers%20in%20private%20chat%20rooms.%20It's%20fast,%20secure%20and%20free." target="_blank"><img src="/twitter.png" width="32px" height="32px"/></a></span>
<span><a href="https://plus.google.com/share?url=http%3A//chatadda.com/" target="_blank"><img src="/google.png" width="32px" height="32px"/></a></span>
</div>
</div>
</body>
</html>我该怎么做呢?
发布于 2016-11-01 17:20:25
请注意,您显示的示例是Chrome应用程序,而不是扩展。你不能复制(也就是说,扩展中的 (原料药) )。和ChromeOS已经被积极地废弃了:你不能发布新的(除了ChromeOS)。
如果只需要一个单独的窗口,则可以使用chrome.windows.create类型调用"popup"。但你不能把它放在其他窗户上。你没有具体说明你需要什么,也许这不是必需的。
解决方案Edmund Lee建议 (使用内容脚本将UI注入DOM)将在其他页面中添加UI。也许是有用的,但是如何使它正常工作是一个广泛而复杂的话题。
发布于 2016-11-01 16:47:47
单击铬扩展图标后,popup.html才是弹出窗口。您需要的是添加一个content.js文件。查看这个所以线程获得详细信息。
Chrome扩展上下文菜单:如何在单击菜单项后将div附加到页面
谷歌文档:脚本
剩下的只是在页面上附加一个dom节点,并使用CSS来定位它。
https://stackoverflow.com/questions/40364504
复制相似问题