Html 如何扩展我的 Chrome 扩展程序的弹出窗口
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8983165/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How Can I Expand The Popup Window of My Chrome Extension
提问by Lost_In_Library
I want to expand the popup window which comes from when user click the extension button...
我想扩展来自用户单击扩展按钮时的弹出窗口...
(I want to expand the size of pop-up window to red area)
(我想将弹出窗口的大小扩大到红色区域)
Here is the code that I'm using to show pop-up;
这是我用来显示弹出窗口的代码;
< style type="text/css" >
body {
min-width: 1005px; /* your desired width */
max-width: 100%;
position: relative;
vertical-align:middle;
}
< /style >
< iframe src="http://stackoverflow.com" width="100%" height="100%" scrolling="auto" > < /iframe >
I tried (in body css) width: 1280px; height: 800px; -but no luck. It's not working correctly...
我试过(在 body css 中)width: 1280px; 高度:800px;- 但没有运气。它不能正常工作...
UPDATE:Similar question( maybe a duplicate ? ); chrome extension, popup window's height
更新:类似的问题(可能是重复的?);chrome 扩展,弹出窗口的高度
回答by Adam Ayres
Chrome extension popups can have a maximum height of 600pxand maximum width of 800px.Changing the width or height using CSS on the html or body element will just cause scroll bars (as you have noticed) when over these maximums. Using something like window.resizeBy(x,y)
will have no effect.
Chrome 扩展弹出窗口的最大高度为 600 像素,最大宽度为 800 像素。在 html 或 body 元素上使用 CSS 更改宽度或高度只会在超过这些最大值时导致滚动条(如您所见)。使用类似的东西window.resizeBy(x,y)
不会有任何效果。
You can hide the scrollbars using CSS but that will not have the desired effect of making the page bigger than the maximums imposed by Chrome.
您可以使用 CSS 隐藏滚动条,但这不会产生使页面大于 Chrome 施加的最大值的预期效果。
One option might be to use a JavaScript dialog/modal in the page when the browser/page action is clicked instead of using the built in popup.
一种选择可能是在单击浏览器/页面操作时在页面中使用 JavaScript 对话框/模式,而不是使用内置弹出窗口。
Some references to similar questions:
对类似问题的一些参考: