Re: Getting WebView and JavaScript to communicate. MFC can do it.
Re: Getting WebView and JavaScript to communicate. MFC can do it.
- Subject: Re: Getting WebView and JavaScript to communicate. MFC can do it.
- From: "Theodore H. Smith" <email@hidden>
- Date: Wed, 11 Jan 2006 11:23:29 +0000
On 11 Jan 2006, at 06:45, Daniel Jalkut wrote:
Hi Theodore - I think what you want is the (relatively) recently
added "WebScriptObject" functionality on WebView.
Search on "WebScriptObject" and if none of that makes sense try
"WebScriptObject Dashboard" because Dashboard widgets use a very
concrete example of setting Cocoa objects as WebScriptObject
properties that can then be accessed from within the JavaScript
context.
The gist is that you wait for your WebView to "have a web script
object available," and then you can simply "setValue" on it to
represent your Cocoa object in the JavaScript namespace with a
specified name.
Daniel
Hi Daniel,
I'm not sure if I understand the docs correctly, but it seems that
WebScriptObject only allows interaction from the opposite direction
that I want. it allows Cocoa apps to get and set stuff into JavaScript.
I want JavaScript HTML pages to be able to get and set stuff into
Cocoa. That is, at the WebView's event time, not any NSButton's event
time.
For example, user clicks on a link in a HTML page. The link activates
some JavaScript, the JavaScript grabs some info from my app. That's
the opposite of what WebScriptObject gives.
WebScriptObject will allow my to click on an NSButton outside of my
WebView (or some other thing which creates an event), the NSButton
can ask the WebScriptObject to get some data from the JavaScripts.
You see? Its the opposite direction.
_______________________________________________
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