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 17:25:07 +0000
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