Window.sizeToContent()
非标准: 该特性是非标准的,请尽量不要在生产环境中使用它!
Window.sizeToContent()
方法根据窗口内容调整窗口大小。为了使其工作,在调用此函数时应加载 DOM 内容,例如,一旦抛出 {domxref("Document/DOMContentLoaded_event", "DOMContentLoaded")}} 事件。
可以强行的调整窗口的最小尺寸。
语法
js
sizeToContent()
示例
js
window.sizeToContent();
规范
此特性不属于任何规范。
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
sizeToContent |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
- Non-standard. Check cross-browser support before using.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.