是否可以仅使用JS,HTML和CSS在Chrome扩展程序的窗口中显示网页? [英] Is it possible to show webpage in a window from my Chrome extension, only using JS, HTML and CSS?
问题描述
我正在尝试开发Google Chrome扩展程序.
I'm trying to develop a Google Chrome extension.
当用户单击扩展按钮时,将出现一个小窗口(不是window.open
/弹出窗口),并显示网页.我具有基本的JavaScript知识,并且听说有可能使用JavaScript.因此,我想在有限尺寸的窗口中显示我的网站.如何使用JS/HTML/CSS以简单的方式做到这一点?
When the user clicks the extension button, a small window will appear (not window.open
/ pop-up) and will display the web page. I have basic JavaScript knowledge, and I heard it's possible with JavaScript. So, I want to show my website in limited size window. How can I do that in a simple way with JS/HTML/CSS?
一个示例(不一样,但是很接近):正在显示的google chrome扩展名在自定义窗口中
An example (not the same thing, but it's close): A google chrome extension which is showing in a custom window
感谢您的任何输入.
推荐答案
您正在寻找的被称为popup
.查看Chrome扩展程序入门教程,了解更多信息.
What you're looking for is called a popup
. Check out the Chrome Extensions getting started tutorial for more info.
http://code.google.com/chrome/extensions/getstarted.html
弹出窗口将打开一个HTML页面,并调整其大小以适合您的内容.因此,在扩展名弹出窗口中显示外部url的最简单方法是将iframe
放置在弹出源中:
The popup opens an HTML page and resizes to fit your content. So the simplest way to show an external url in a extension popup would be to place an iframe
in your popup source:
<iframe width="800" height="600" src="http://www.google.com"></iframe>
这篇关于是否可以仅使用JS,HTML和CSS在Chrome扩展程序的窗口中显示网页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!