I was hoping I would be able to ship my application
with copies of _both_ WebKit and WebCore as _private_ frameworks in
my application bundle, thus making my app immune to any Apple updates
to the system WebKit. To borrow a term from Microsoft, sort of the
"side-by-side" dll concept. Is this thinking flawed?
Even if this was technically possible, you don't have a license to the
Web Kit framework that permits you to redistribute it in this fashion.
My "custom Javascript" that I implemented was simply allowing the
Microsoft Internet Explorer 'window.external.<function>()' to be
recognized. This JS calls a matching C function in the host
application that is embedding the browser. Since all of our web
content requires that we can use JavaScript to automate the host
(and pass return values back to JavaScript) I was hoping that this
would be possible in WebKit. Turns out, the changes to WebCore
are pretty simple to allow this to happen. I post a Cocoa
notification that my host app receives that contains the function
name and arbitrary parameter list, and populate the notification
NSDictionary with a return value that I convert back into the JS
interpreter code in WebCore.
Any thought that Apple might provide such functionality in future
WebKits?
We will definitely provide a nice way to do that sort of thing easily
with a future version of the Web Kit.
There are even some hack-like techniques that work to do this with the
current WebKit. Here's a sketch: In one of the delegate callbacks that
indicates a page is loaded you can use
stringByEvaluatingJavaScriptString: to set the value of window.external
to a function that turns around and calls window.alert with a magic
string. Then the WebView's UI delegate can notice the magic string and
run the C code. To send the result back you then can use
stringByEvaluatingJavaScriptString: to set a JavaScript global. It's a
bit painful but developers have done it successfully.
-- Darin
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webcore-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webcore-dev/email@hidden