WebKit interactivity and caching

5 views
Skip to first unread message

rusty

unread,
Aug 26, 2008, 8:23:28 AM8/26/08
to iPhoneWebDev
Does anyone know if there is a documented (easy) way to interact with
the contents of a webkit loaded page from an sdk app?
I'd like to call out to the host window process when a user clicks on
certain elements in the html.

I am going to use tableView to drill through a list of menus but then
my detail view is really better served as html (or should i say
easier).

I'd like to load the toolbar with the menu tree navigation item when
the user is on the main detail screen but I have html sub screens that
create an iUi toolbar for navigation within iUi enhanced html.

Additionally, I read somewhere that webkit does no client side
caching. In other words, on every distinct page load, every js
script, css and image will have to reload from the web server. That
kinda stinks. Is it true?

thanks

Ed Wrenbeck

unread,
Aug 26, 2008, 9:49:42 AM8/26/08
to iPhoneWebDev


On Aug 26, 8:23 am, rusty <rustyza...@gmail.com> wrote:
> Does anyone know if there is a documented (easy) way to interact with
> the contents of a webkit loaded page from an sdk app?
> I'd like to call out to the host window process when a user clicks on
> certain elements in the html.

I'm working on a project right now that is doing the same type of
thing including a web kit view in a cocoa app. If you check the docs
for say NSWebView you might see a method that allows you to call
javascript on the html side. Its also easy to load an html request
into the web view. I would say other cocoa frameworks might have
similar functionality. Having the html talk to the native side is
trickier.

> Additionally, I read somewhere that webkit does no client side
> caching.  In other words, on every distinct page load, every js
> script, css and image will have to reload from the web server.  That
> kinda stinks.  Is it true?

There are different caching options. It might be cached to disc, it
might be cached only in memory, it might not be cached at all. It
depends on what you do on the native side. I would just check the
framework docs for what you want to do in that framework. For example,
a framework might only allow in memory caching but not "on disc"
caching. There can be other ways around the problem such as storing
the html as a file on the local side and loading it as a string with a
baseurl reference to the server.

> thanks

Kevin Menard

unread,
Aug 26, 2008, 10:28:42 AM8/26/08
to iphone...@googlegroups.com
On Tue, Aug 26, 2008 at 9:49 AM, Ed Wrenbeck <edwre...@gmail.com> wrote:

 There are different caching options. It might be cached to disc, it
might be cached only in memory, it might not be cached at all. It
depends on what you do on the native side. I would just check the
framework docs for what you want to do in that framework. For example,
a framework might only allow in memory caching but not "on disc"
caching. There can be other ways around the problem such as storing
the html as a file on the local side and loading it as a string with a
baseurl reference to the server.

I would love to be proven wrong on this, but I don't think there's any reasonable way of providing your own caching mechanism.  The problem is that WebKit fetches all of the external resources on a page as a single transaction when you load a request for a page.  So, while you may be able to load an HTML page saved to disk, you don't have the opportunity to hook in to load all the other resources.

-- 
Kevin 

Rusty Zarse

unread,
Aug 26, 2008, 12:51:59 PM8/26/08
to iphone...@googlegroups.com
II'll check the docs.  Thanks.  If no caching is provided by default, you could write your app to download all the resources locally, then load a locally referenced html file.  That is an awful lot of work, though.  Definitely on the far side of reasonable.  

Certainly encourages one to return to the days of tiny html pages :)
--
Rusty Zarse - VP Technology
OckhamResearch.com / GlobalAccessHoldings.com
678-461-9793 / rza...@ockhamresearch.com
Reply all
Reply to author
Forward
0 new messages