How to trigger camera from a remote html page loaded in childbrowser in ios ? - iphone

I need to access camera from a remote html page. I load this html page through child browser . Need to open camera or any native view on a button click on html file..

No sure if this is the best/most elegant possibility, but it should work:
By click on button load an specific URL.
The UIWebView has delegate methods to inform you, when a page finished loading.
In the – webViewDidFinishLoad: method check if the loaded URL was your specific button URL, if YES show camera/any other native view.

Related

bookmark button fails to load the canvas

when using my app bookmark button that is displayed in the top right of any canvas application interface (apps.facebook.com), I don't get my app loaded/reloaded in the iframe, the iframe show the "loading" animation but ends void with only the facebook footer
the link of the bookmark is correct: it will load successfully the app if pasted in a new browser window; the URL of the apps.facebook.com interface change to the correct URL clicking the bookmark but the application is not loaded, but forcing a reload of the whole browser page the app is correctly loaded... it seem that the iframe loading fails but not the js URL edit
I'm puzzled because checking my server log I don't catch any request from facebook for the canvas page, therefore it is failing before
anybody has observed any similar behaviour?
As Claudio Felicioli figured it, you must set the App Namespace.
https://developers.facebook.com/apps/
On the left, Click on your application
Click Edit Settings
Type information for App Namespace
Click Save Changes

Is it possible to call a URL without a visible view?

Is it possible to load a URL without a visible view?
Basically I'm trying to submit some information to my server by a php page. It works from my webViewController, which has a working view, but not from my appDelegate, which doesn't have a visible view.
I recommend you use ASIHTTPRequest to submit the information to your php page.

How to push a view from a web page?

Suppose my app will load a local web page which is stored in my app bundle. I want to push the view or present a view when the user click a link or an image inside that web page. How to do this? Let's make this be general question: how to communicate with my app from a local web page?
Thank you.
Use "webview.request.URL.absoluteString" to get the request-string of the clicked link in the delegate-method "webViewDidFinishLoad:" or "webViewDidStartLoad:".
then you can scan this url for some special substring.
For example you could make a link like ".../index.php?iPhone_action=abcdef".
In the delegate-methods you can check if the link has the substring "?iPhone_action=" and if it does, then put the part of the link, whick follows "?iPhone_action=" in a NSString.
(in our example it would be "abcdef").
Depending on the value of this NSString you could fire a action in your app.
There is an undocumented method to catch the event when you click on a link in UIWebView. You can do whatever you want to do in that method.Search on google/stackoverflow for it. Or see my answer in this stackoverflow post.
Show alert view when click on a link

How to submit a form in a UIWebView loaded with HTMLString:baseURL:?

oHi,
I'm displaying a html page which contains a form with some input text fields and a submit button.
If i display the page using loadRequest: everything works fine.
If i display the same page using loadHTMLString:baseURL: the submit button is not working anymore.
The adress which is supposed to be called is :
http://..../lire.php?id=33570#bloc_commentaire
If i log the adress it tries to reach i got :
applewebdata://BF6F3D92-9F36-40CA-A3EB-BCD3F14852B6#bloc_commentaire
Do you have any idea of what i should do to be able to post a form loaded statically using loadHTMLString:baseURL: ?
Thanks,
Vincent
The problem occurs because your web view doesn't know where to post the data because the html is loaded from a string and not a specific web server.
Make sure you are setting baseURL correctly in your call to
[webView loadHTMLString:(NSString *)string baseURL:(NSURL *)baseURL]
Details:
When the webview finds a relative url in the html, it joins it with the baseURL to form an absolute url which can be used to submit or click on. For instance:
Given http://www.test.com/foo/ as baseURL and a relative url tag lke click me
When the user clicks on the link, the view will make a request to http://www.test.com/foo/bar/hello.php

iPhone/iPad webview - Event fired after HTML is rendered?

I have a webView which displays a local html file loaded with jQuery etc. The page takes about 2 seconds to render.
Is there an event in the WebViewDelegate that says, "The page is rendered"?
Once I pass the HTML to the webview control returns immediately as the webview sets off working to render in som background task.
I need to know when it's done.
You're looking for webViewDidFinishLoad. Here's Apple's documentation: UIWebViewDelegate Protocol Reference.