这篇翻译不完整。请帮忙从英语翻译这篇文章

非标准
该特性是非标准的,请尽量不要在生产环境中使用它!

The Window.sizeToContent() 方法根据窗口内容调整窗口大小。 为了使其工作,在调用此函数时应加载DOM内容,例如,一旦抛出 DOMContentLoaded 事件。

可以强行的调整窗口的最小尺寸。

语法

window.sizeToContent() 

 例子

window.sizeToContent();

 规范说明

此功能不是任何规范的一部分

浏览器兼容说明

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
Basic support
Non-standard
Chrome No support NoEdge ? Firefox Full support Yes
Full support Yes
Full support 20
Notes
Notes The mimimal size is clamped to prevent the window from being too small for the user to interact with.
IE ? Opera ? Safari ? WebView Android No support NoChrome Android No support NoEdge Mobile ? Firefox Android Full support Yes
Notes
Full support Yes
Notes
Notes This method has no effect as a page is always in a tab.
Opera Android ? Safari iOS ? Samsung Internet Android ?

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
Non-standard. Expect poor cross-browser support.
Non-standard. Expect poor cross-browser support.
See implementation notes.
See implementation notes.

其他链接

文档标签和贡献者

此页面的贡献者: usernameisMan
最后编辑者: usernameisMan,