Web page cannot access camera in WebView - ios

There is a web page that scans qr codes via a camera.
It works beautifully in iphone's safari browser but in a webview or wkwebview it does not.
I do not own or control js code, so its hard to tell what it requests. Application itself has all the required permissions for camera - it also has its native qr scanner that works fine.
SFSafariViewController feels like an overkill and yet I did not manage to present it in a way that shows non blank screen. WebView's delegate methods are not called when camera is requested by a web page... I am aware of solutions that require to manually open camera on redirect and then pass back content to javascript, but I was expecting everything to work out of the box...

Related

Make UIWebView behave exactly as Safari

I am building a webview app that should load a specific website using UIWebView, but the webview doesn't behave as Safari.
A lot of links don't open, and file download and preview doesn't work, also, some JavaScript doesn't work.
Is there a way to make my web view behave exactly as Safari browser?

Different behaviour in WKWebview and Safari regarding CSS

There seem te be some subtle differences in the Implementation or configuration between WBWebView and Safari (and SFSafariViewController) that renders a part of the Website I want to display unusable.
Here is what I am trying to do:
Basically all that is needed is an "App" that just opens a specific website in fullscreen mode, so no chrome, URLs or additional navigaton buttons are present. The Website works fine on Safari on iOS (and every other (modern) browser on desktop or mobile) but the menu does not when embedded in the App.
All I did was creating a new single view Application in Xcode, drop in a WKWebView and have it load the URL. The part of the page not working is this menu component that is used throughout the site: http://tympanus.net/codrops/2013/04/19/responsive-multi-level-menu/ So basically the user has no way to navigate. While debugging the website it seems like when I push the menu button the menu does not expand like it should because the changed css classes dont get picked up correctly. If I manually toggle the css classes on the menu-element it gets displayed correctly. It makes me wonder if there are some additonal constraints related to WKWebView?
Can anyone tell me if there are any settings or configurations I can alter that allow the website in WKWebView to behave exactly the same as it would under Safari?
As far as I understand SFSafariViewController I always get the browser toolbar and navigational elements which I dont want to have in the app, so that is not an option- or is there a way to get rid of that?
Any help or pointers would be greatly appreciated :)

Force UIWebView to load mobile version of website, like Safari does

I'm making an app where having a UIWebView is absolutely necessary. However, I'm having a problem where the UIWebView doesn't load the mobile version of the website.
I've read some questions on StackOverflow, and they all seem to say it's up to the website to decide what type to display, and that the UIWebView acts just like Safari.
However, I have tested with 9 different links to different websites and they all load the desktop version in my UIWebView and the mobile version in Safari.
What could I do to force the UIWebView to load the mobile version just like Safari does? Are there a type of headers I could send or cookies to set or anything that actually works?
Furthermore, the desktop versions scale terribly in my UIWebView. They do allow zooming, but when I release they all (the websites) reset back to the same position. And when I try to scroll horizontally, they just snap back into the original position, which leaves the website impossible to read and my UIWebView utterly useless. If I can't force the mobile page, how can I make the desktop versions act differently?
I forgot to set the constraints for the UIWebView, which caused the content to be rendered wrongly. I don't know how that's relevant, but constraining the UIWebView seems to not only render the content correctly but also display the mobile site.

iOS: Run code only after it's been added to the home screen

I'd like know if there's away to run a bit of code only after it's been installed to the home screen on iOS. This is for internal use only so I don't need it to work on other platforms. Just iOS.
Basically, I want to add a few custom icons to iOS devices that do specific things. One will open a PDF and that's the one I'm having a hard time working with.
So, here's the flow...
User goes to URL on their iOS based device, there is nothing to see here, but then they add the URL to their home screen. Once they click on the home screen icon, the page opens and redirects to the a PDF that lives online. The pdf can live online since they will always have wifi.
Any suggestions?

FaceBook JavaScript API in native app UIWebview

I am creating an app which is reusing some of the HTML pages from my site. In one of the pages, there is a share event in facebook functionality. This is not working in UIWebview as there is no concept of "pop ups" in uiwebview. FB.Login() opens a new tab in an actual browser, but in UIWebview, it loads on top of the existing page.Hence after login, while the actual browser tab closes itself and transfers the control to the callback function in the original tab, UIWebview page just turns blank as it probably cannot find the original call back function anymore. Any solutions?

Resources