• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Resizing a WebView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Resizing a WebView (From: "Mike O'Connor" <email@hidden>)
 >Re: Resizing a WebView (From: John Stiles <email@hidden>)
 >Re: Resizing a WebView (From: "Mike O'Connor" <email@hidden>)

  • Prev by Date: Re: Drawing over a view's subviews
  • Next by Date: Re: WebKit and XSLT
  • Previous by thread: Re: Resizing a WebView
  • Next by thread: NSButtonCell: NSChangeBackgroundCellMask not working as expected
  • Index(es):
    • Date
    • Thread