Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Can stringByEvaluatingJavaScriptFromString: call a local javascript function?



I'm porting this program from Windows that uses the IE ActiveX control to
hold a webpage with a good chunk of its functionality. At various points it
wants to call JavaScript functions in the page, for instance

feedback("string1", "string2", "string3")

Now, in Windows they do some song and dance with the
IHTMLDocument::get_Script() method to get a scripting pointer, then they
look for the particular function, and yadayadayada. I kinda hoped that with
WebKit I could just go something like

NSString* script = [[NSString alloc]initWithFormat:
@"feedback('%s','%s','%s')",tbid,uid,type];

NSString* result = [fController
stringByEvaluatingJavaScriptFromString:script];

where fController is my WebView*; but, well, that doesn't work.

That particular feedback() function just calls window.open() with a URL
constructed with the arguments and stores the window in a global so that it
can close the existing one on the next call to feedback(); if I make
"script" the window.open() call with the appropriate URL directly, it works
fine and opens a new window as expected. However, there's other local
functions I need to call somehow that I can't fake like that. So, is it
possible at all with WebKit to call a local JavaScript function like the
Windows program does? How do I go about it, or what alternatives can some
kind soul suggest?

-- 
Alex Curylo -- email@hidden -- http://www.alexcurylo.com/

You know you've had a good night when you wake up
and someone's outlining you in chalk.


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webkitsdk-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webkitsdk-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.