Make UIWebView behave exactly as Safari - ios

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?

Related

Web page cannot access camera in WebView

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...

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.

Open Cordova iOS external links in webview like an iFrame

I'm building an iOS app using cordova that basically opens news links to external sites. However iFrames don't seem to want to play nice on iOS. Is it possible to use UIWebView much like an iframe? I want to just embed a box on my app page so I can keep my apps header navigation and such. Instead right now opening links just pops the page up over everything.

Open specific page of a pdf in iFrame on iPad

I am trying to open a specific page of a pdf (for example, http://cb.vu/unixtoolbox.pdf#page=14) inside an iFrame. While it works on desktop browsers, it is not working on an iPad.
Also noticing that, this does not work on the iPad even without the iFrame if I want to go the page 14 by typing http://cb.vu/unixtoolbox.pdf#page=14 directly in the address bar of mobile safari.
Has any of you came across this problem? If so, how did you solve it?
Thanks a lot for any help!

Resources