iOS What is the best way to access hardware on IPAD 2 from a web application?

DonRobb

macrumors newbie
Original poster
Oct 17, 2011
18
0
Is it possible to start a process on an IPAD 2 from a web application?
I would like to create platform independent code (possibly using Java Script) and be able to start platform dependent code from withing it. What should I be reasearching to learn how to do this? Is it possible?
 

ChristianVirtual

macrumors 601
May 10, 2010
4,101
267
日本
To my undersanding you are not allowed to download binary from Internet; JS you can download in browser but HW only through what apple provide you.
You find more on developer.apple.com
 

DonRobb

macrumors newbie
Original poster
Oct 17, 2011
18
0
Are you saying that it's not possible? I have written stuff on the IPAD that touches IPAD hardware. I would just like to make calls to it from Java script? Even if I could modify a file or makes calls to a dll or something it would achieve what I want to do. Do you know to where to look on the apple dev to learn how? Or do you think its just not possible?
 

phantax

macrumors member
Feb 2, 2009
72
0
You won't be able to make native calls through a web application, that would be quite a security nightmare.

The most you can do is use the web app UI elements to style your application to resemble a native one.
 

DonRobb

macrumors newbie
Original poster
Oct 17, 2011
18
0
I posted the same quesion on stack overflow. This is the answer I got.

"Not directly no. The web browser is pretty much a sandbox. However another application can register a URL handler and the browser can call out to that URL"

Do you know where I can find documetation that explains this?
 

phantax

macrumors member
Feb 2, 2009
72
0
You can find more information on how to do this by searching for Custom URL Schemes.

Be aware that if you use this approach that users will be taken out of Safari and into the native app.

The most you can do is pass along some information to the app when it launches, so I am not sure this is actually what you are after.
 

DonRobb

macrumors newbie
Original poster
Oct 17, 2011
18
0
It is true that I would like to get values back and display them in the browser,
let the user modify them and write them back to the application\hardware. I did seach for the Custom URL scheme. Seems to confirm what your saying about only being able to pass info in to an app when it launches. If there is no way I'll have to live with it. However It is desirable to do common UI code in java script so it only has to be written once for different mobile platforms and do as least as possible that is platform specific, such as reading and writing values. If anyone has further ideas on how this might achieved I would appreciate there comments. Thank for you answer my friend.
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,281
563
Harrogate
It is true that I would like to get values back and display them in the browser,
let the user modify them and write them back to the application\hardware. I did seach for the Custom URL scheme. Seems to confirm what your saying about only being able to pass info in to an app when it launches. If there is no way I'll have to live with it. However It is desirable to do common UI code in java script so it only has to be written once for different mobile platforms and do as least as possible that is platform specific, such as reading and writing values. If anyone has further ideas on how this might achieved I would appreciate there comments. Thank for you answer my friend.
What you are describing might be possible by embedding a UIWebView within your application. This could, in effect, be the entire interface if that's what you want. You can call Javascript (to pass values back via function/method calls) via the stringByEvaluatingJavaScriptFromString: method and use the delegate object to capture load requests to allow the JS to interact with the Objective-C.

I would note this is likely to make your users hate you. My bank has a, so-called, iOS app that uses HTML/javascript for it's entire interface and it does not feel native. It presents a vastly sub-optimal experience. iOS users expect apps to feel like iOS apps. If they (I included) wanted to use a website we'd use a website.
 

ppilone

macrumors 6502
Jan 20, 2008
361
0
...

I would note this is likely to make your users hate you. My bank has a, so-called, iOS app that uses HTML/javascript for it's entire interface and it does not feel native. It presents a vastly sub-optimal experience. iOS users expect apps to feel like iOS apps. If they (I included) wanted to use a website we'd use a website.
^ don't get me started on the Netflix "app".
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.