Re: How to deal with Java Script in None-GUI applications?
Re: How to deal with Java Script in None-GUI applications?
- Subject: Re: How to deal with Java Script in None-GUI applications?
- From: Nicko van Someren <email@hidden>
- Date: Mon, 30 Jan 2006 18:19:11 +0000
On 30 Jan 2006, at 17:32, Andrei Tchijov wrote:
Nicko,
Thanks for reply. I have tried it already and it does work
wonderfully. And you can get WebScriptObject from WebView. I
guess I need to have more fate into Apple :-).
I'm glad that worked for you.
Just for completeness (for the mailing list archive) it is worth
noting that if you are doing this sort of thing in a command line
tool you are usually still going to need to have a Run Loop running
because the URL loading system makes extensive use of this. I'm
guessing you already had a run loop in play in your program but a
typical simple port of some Unix command line program would not, and
might fall foul as a result.
Nicko
Andrei
On Jan 30, 2006, at 12:25 PM, Nicko van Someren wrote:
On 30 Jan 2006, at 17:05, Andrei Tchijov wrote:
In my application I need to evaluate Java Script ( I need to
extract proxy settings from *.PAC file, which amounts to invoking
Java Script function defined in the file ). The problem is, that
I need to do it in command line tool. There is no GUI, there is
no WebView to which I can send windowScriptingObject.
Documentation for WebScriptObject class states that it can not be
instantiated by itself. Does it mean that I am stack? Is it
possible to get WebScriptObject without WebView object?
Alternatively, is it possible to instantiate WebView object
inside command line tool?
I don't know about creating a WebScriptObject without a WebView
but there is certainly no reason I can think of why you shouldn't
be able to create a WebView without displaying it, e.g.:
WebView wv = [[WebView alloc] initWithFrame: NSMakeRect
(0,0,100,100) frameName: @"Foo" groupName: @"Bar");
[[wv mainFrame] loadHTMLString: someHTML baseURL:
someBaseURL]; // Get your PAC file in here somehow
NSString *request = [NSString stringWithFormat: @"FindProxyForURL
(%@, %@)", urlString, hostString];
theProxy = [wv stringByEvaluatingJavaScriptFromString: request];
Nicko
_______________________________________________
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