Re: Resizing a WebView
Re: Resizing a WebView
- Subject: Re: Resizing a WebView
- From: Tim Lucas <email@hidden>
- Date: Thu, 16 Jun 2005 03:00:37 +1000
On 16/06/2005, at 12:06 AM, Mike O'Connor wrote:
Safari seems to do it. For example it will zoom the window to a width
based on the content it is showing. And Webview knows when to show
scroll bars and how far to scroll them, so it must know the size of
the content.
In my case, I'm not displaying general Web pages, but usually custom
content in the form of a table with specific (but not known in
advance) width and height.
The webkit obj-c reference is quite thorough now thanks to widgets.
Have you checked it out?
From a glance of the docs, you have two options:
1) The DOM methods
2) evaluateWebScript:
For number 2, see here:
http://developer.apple.com/documentation/Cocoa/Conceptual/
DisplayWebContent/Tasks/JavaScriptFromObjC.html#//apple_ref/doc/uid/
30001214-BCIIEAFH
for example:
WebScriptObject *win = [webView windowScriptObject];
NSNumber *width = [win
evaluateWebScript:@"document.getElementById('tableID').offsetWidth"]
NSNumber *height = [win
evaluateWebScript:@"document.getElementById('tableID').offsetHeight"]
- tim lucas
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden