Run javascript without UIWebView possible?

Run javascript without UIWebView possible?

Is it possible to run some javascript code (having perhaps an NSString as input) without using a UIWebView? I would like to run this code in a separate thread so UIWebView is not possible and I don't really want to render anything, just get back the results.

Preventing PHP scripts used in a iPhone app from being access via web browser


Custom easing action with Cocos2D-iphone
I have not tried this, but here is one idea:.
How to lose margin/padding in UITextView?
Write code to allocate an empty UIWebView but doesn't add it as a subview anywhere, and just directly call - (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script on your javascript..
Creating a PHP Webservice with binary-encoded parameters?
Then use NSOperation to run that in parallel..
Is there an iPhone SDK API for twitter? [closed]
Any reason that might not work for you? I think it would avoid displaying anything for the UIWebView..
iPhone Safari: Scroll a list inside a html container
As a side note, I can't think of anything you can do in javascript that you can't do more quickly directly in Objective-C.

iphone: making a new UIImage from data from an XML document
Except maybe parsing javascript that you get externally, which may be considered a no-no by Apple, depending on the details..
What's the best way of learning iPhone programming when coming from Java?
Guessing at your goals: If you want to parse a JSON server reply, I recommend the json-framework library hosted on google code.

It has a nice interface, and it is surprisingly easy to learn and integrate..


I think Parmanoir's article Taming JavascriptCore within and without WebView may give you some advice..


 self.timer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(getResults:) userInfo:nil repeats:YES];  -(void)getResults {     NSString *value = [self.webView stringByEvaluatingJavaScriptFromString:@"javascript"]; }    
Any reason you couldn't just do something like this.

Shouldn't be that big of an overhead on your main thread.


62 out of 100 based on 37 user ratings 712 reviews