How to develop an iPhone app using its webviewer? Like in Andriod we can develop an app using webviewer.
It will help me in developing mobile app using Javascript.
Please NOTE:- I want to keep the core logic JS FILE of APP "inside" the phone only. I don't want to host my application and redirect the user any where.
EDIT:- I want to develop a mobile application using HTML,CSS and Javascript. I want to keep my APP LOGIC inside the phone only.
Yes in iOS you can use UIWebView to display any HTML content, HTTP links etc. You could also invoke javascript from your Objective C code or vice versa...
HTML data -
NSString *html = @"<html><head><title>Should be half</title></head><body>I wish the answer were just 42</body></html>";
[webView loadHTMLString:html baseURL:nil];
To evaluate javascript from ObjectiveC code -
NSString *title = [webView stringByEvaluatingJavaScriptFromString:@"document.title"];
This technique is not limited to one-liners, or accessing simple properties. Here’s an example of two lines of JavaScript code executed in order, as you would expect:
[webView stringByEvaluatingJavaScriptFromString:@"var field = document.getElementById('field_2');" "field.value='Multiple statements - OK';"];
You can also call JavaScript functions this way. And if you want to call a JavaScript function that does not already exist in the web page that you’re downloading, you can “inject” it yourself with this technique:
[webView stringByEvaluatingJavaScriptFromString:@"var script = document.createElement('script');"
"script.type = 'text/javascript';"
"script.text = \"function myFunction() { "
"var field = document.getElementById('field_3');"
"field.value='Calling function - OK';"
"}\";"
"document.getElementsByTagName('head')[0].appendChild(script);"];
[webView stringByEvaluatingJavaScriptFromString:@"myFunction();"];
Check out - Javascript in UIWebView