Hi Alex,
Yes that should work fine with no problems as I do something similar for
the day job, one thing I would check that WebKit Object you have is top
level Main View.
You will need to add some extra delegates to deal with opening windows and
alert dialogs, as by default they won't appear until you implement them, as
on window's system a window.open will open another instance of IE, which is
not going to happen within your custom WebKit application.
Check what result returns if empty, or another idea is to make the
javascript function return something so you can validate that this is
working fine, as I guess its probably is.
Hope this helps,
Mark.
> Message: 5
> Date: Wed, 07 Dec 2005 09:47:49 -0800
> From: Alex Curylo <email@hidden>
> Subject: Can stringByEvaluatingJavaScriptFromString: call a local
> javascript function?
> To: <email@hidden>
> Message-ID: <BFBC6045.1B61C%email@hidden>
> Content-Type: text/plain; charset="US-ASCII"
>
> 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