Le 24 nov. 08 à 16:42, Pierce Freeman a écrit :

Hi everyone.

I am wondering if there is some way to call the getElementById on a website through Cocoa, and then return the value of the field. I am assuming it would somehow be through WebKit, but I am not sure how to do this (as well as if the method needs a different way to get the page's code). The use
would be the application getting the value of a hidden field, and then
outputting it to the user.


Sincerely,

Pierce Freeman

You can do this either by using the Cocoa DOM API directly:

You call -mainFrameDocument on your WebView to get a DOMDocument instance, and have access to the DOM functions from here (there is no up-to-date doc of the Cocoa DOM API, you will have to check headers files directly to see what function is available, for example the DOMDocument.h file show you that there is a -[DomDocument getElementById:] method.

or you can execute js from your Cocoa code:

http://developer.apple.com/documentation/Cocoa/Conceptual/DisplayWebContent/Tasks/JavaScriptFromObjC.html





_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to