I'm quite new to xcode, because I mostly work with JS and HTML5. I've decided to create a simple webview app that enables me to work with JS and HTML5 (going to put it on Github asap)
Now my question is about accessing certian iPhone features that I cannot use in Safari or Chrome (the reason why I'm creating this). So the question is: is this possible? for example, I can't access the camera (as a fullscreen background I mean) in an iOS browser, but can I use it in webview?
I'm quite new to xcode, because I mostly work with JS and HTML5. I've decided to create a simple webview app that enables me to work with JS and HTML5 (going to put it on Github asap)
Now my question is about accessing certian iPhone features that I cannot use in Safari or Chrome (the reason why I'm creating this). So the question is: is this possible? for example, I can't access the camera (as a fullscreen background I mean) in an iOS browser, but can I use it in webview?
Share Improve this question asked May 29, 2014 at 22:01 Bob van LuijtBob van Luijt 7,59815 gold badges62 silver badges107 bronze badges3 Answers
Reset to default 2You need any method of municating between UIWebView and the containing app. There are libraries out there that do just that, some better some less. In case you do not want them... So to outline the techniques to do that:
- App talking to the webView - using
[webView stringByEvaluatingJavaScript:...]
- Webview talking to the app - using url directives. Which is essentialy
window.location = ...
with custom fake urls, and then parsing the NSURLs in the delegate methodwebView:shouldStartLoadWithRequest:navigationType:
and of course returningNO
to prevent actually navigating to your fake urls.
If you find that you are missing consecutive URL requests, you could write a JS function that takes the URLs, puts them all in an array, pops one by one and sending them to the browser in a setTimeout(..., 0)
.
You need to use something like this - Cordova or PhoneGap ( Both are the same thing )
"Apache Cordova is a set of device APIs that allow a mobile app developer to access native device function such as the camera or accelerometer from JavaScript. Combined with a UI framework such as jQuery Mobile or Dojo Mobile or Sencha Touch, this allows a smartphone app to be developed with just HTML, CSS, and JavaScript."
Here is a description of all the device features cordova or phonegap allow you to use - Plugin API's
Yes, is it possible, but using a web app container like Phonegap.
If you need more info how install it visit this web.