简体   繁体   English

如何使用JavaScript获取HTML文档“所需”的最小宽度?

[英]How can I get the minimum width an HTML document 'needs' using javascript?

I am using "wkhtmltoimage" to render images of HTML pages. 我正在使用“ wkhtmltoimage”来呈现HTML页面的图像。 Due to bugs in "wkhtmltoimage" (where it sometimes sets the page width to 32768 pixels), I need to be able to accurately establish how much the ideal page width should be. 由于“ wkhtmltoimage”(有时将页面宽度设置为32768像素)中的错误,我需要能够准确地确定理想的页面宽度应该为多少。

Things like headers can stretch to fill available width, so straightforward document body width values are not helpful. 标头之类的东西可以拉伸以填充可用宽度,因此简单的文档正文宽度值无济于事。

Is there any means with JavaScript (or jQuery) to determine what the best width should be? JavaScript(或jQuery)是否有任何方法可以确定最佳宽度?

使用screen.availWidthscreen.availHeight

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM