开发者

C# to calculate HTML document size by Url

I want to get HTML height and width for given url. I am using visual studio 2008 and this is for asp.net application.

I have no idea开发者_开发问答 how to do it. I am looking for some method calculate and return width and height of the browser window that would fit the WHOLE content.

please help!

Thanks


You don't want to do what you think you want to do.

I think your real question is "how do I make my webpage fit properly in the browser?" The answer is to scale and adjust your page on the client-side with Javascript and CSS rather than to change things on the server-side. A well written webpage will resize itself if the user resizes the browser. It shouldn't have to do a postback to the server to adjust its size.


Basically it's not possible serverside. You can use JavaScript to calculate it clientside, but the best/recommended approach is to learn how to use HTML and CSS correctly, and design a fluent layout, that automatically scales.


There has to be an actual call to the page so that you can find the size of the screen of the browser making the call. To find that you can use the HttpCapabilitiesBase.ScreenPixelsHeight Property

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜