Re: Optimal height for WebView
Re: Optimal height for WebView
- Subject: Re: Optimal height for WebView
- From: Eric Gorr <email@hidden>
- Date: Fri, 04 Jan 2013 12:19:31 -0500
Sent from my iPhone
On Jan 4, 2013, at 11:34 AM, Keary Suska <email@hidden> wrote:
> On Jan 4, 2013, at 9:19 AM, Eric Gorr wrote:
>
>> It seems like this should be a simple question. I can access the NSScrollView of the WebView and ask the scroll view for the height of its document view, but the height it returns is the current height of the WebView, not the height of the content it currently contains.
>>
>> If I reduce the height of the WebView, eventually the vertical scrollbar will appear, so someone knows the real height of the content the WebView contains. I simple want to be able to obtain that value so I can size the WebView to this height, if it is reasonable to do so.
>>
>> How can I do this?
>>
>> Various proposed solutions I have found do not work.
>
>
> First off, to avoid someone proposing a solution that you have already tried, you should actually mention which proposed solutions you have tried and how they didn't work for your case. So, risking that you have already tried this, what does [[yourWebView mainFrame] webView] frame] give you?
>
>
The current height of the WebView, not the height of the content - which is smaller.
I did just locate a solution that does work, but I am not really happy with it because it seems more complicated then it should be. Check out:
http://stackoverflow.com/questions/2675244/how-to-resize-webview-according-to-its-content
Note, it does not appear to be necessary to disable the scrolling and it is necessary to first resize the WebView to a small height as mentioned by Miraaj in a comment on the answer.
Now, one problem i am having with this solution is that I see a flicker with the WebView shrinking and then growing larger.
It really does seem like there should be a way to ask for the height of the content regardless of the current height of the WebView.
If there is not, I will probably go ahead and file a bug.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden