Xamarin.Forms WebView, WKWebViewConfiguration, and Sending "Mobile" Headers - ios

I'm getting back into Xamarin.Forms, and I've discovered a new behavior of iOS 13 Safari on the iPad called "Desktop-Class Browsing." It's covered in detail here:
https://developer.apple.com/videos/play/wwdc2019/203
The problem for me is that I need my Web application to be able to detect if a normal Web browser is viewing it or if it's being viewed by a Xamarin.Forms.WebView. From my Web application, I used to be able to detect a Web view with the user-agent string or with the X-Requested-With header. But if my Web view is running on an iPad on iOS 13, it will enter desktop mode, which yields a desktop Safari user agent a no X-Requested-With header, and I can no longer detect that it is a Web view. This is referenced at 2:56 in the above video.
In a native iOS application, I can apparently use WKWebViewConfiguration to control these desktop-like featuers:
https://developer.apple.com/documentation/webkit/wkwebviewconfiguration
I think this is demonstrated at 9:01 in the video in my first link.
How can I use WKWebViewConfiguration with Xamarin.Forms? I see a WebKit.WKWebViewConfiguration class, but how can I utilize it with Xamarin.Forms.WebView?

Unless you follow the steps in this article, your app is using UIWebView instead of a WKWebView
There are several ways of getting access to editing the WKWebViewConfiguration:
You can use a "Custom Renderer" to implement your own WKWebView as shown in this Official Xamarin Forms example, and edit the WKWebViewConfiguration there.
Another possible way that I haven't tried- You can also implement a WKWebView inside your forms using the steps mentioned here. And then just edit that property.

Related

how to open webview inside facebook messenger on desktop web browser

I'm trying to implement some features inside a web view in facebook messenger. on the phone the webview is opening fine, but in desctop web browser the webview is opening inside a new tab.
im using the following feature:
buttons:[{
type: "web_url",
url: "https://www.oculus.com/en-us/rift/",
title: "Open Web URL",
webview_height_ratio: "compact",
messenger_extensions: true,
}
I know that maybe it is supposed to open like this but you all can agree that if I'm implementing a custom feature inside the conversation it would be mach better to open it inside a small webview in the conversation.
does anyone knows if this even possible?
You have to follow the steps in these docs.
Make sure to read the docs for desktop and add the X-Frame-Options header. The troubleshooting section in the same docs is your friend.
Two caveats:
X-Frame-Options header does not seem to be enough for firefox. I'm in the process of building a bot using webview, and when I figure out which headers to send to make firefox work, I will post them here. EDIT due to some bugs within the platform on the web, I've postponed this project.
There seem to be a problem with getting page-scoped user ids on desktop. Read my question.

iOS App with Webview inspecting > find URL

I'm using an iPhone App that has some important information on it, but I also figured out that it uses a webview. And I'm not sure if it's safe; like; is it over https? What URL is being called?
Is there a way you can find out what Website is being called in the webview? Like you can do inspect element when using Safari from OSX with usb-connected iPhone.
UIWebview works for any url you call it with. If your site is https, the communication will be encrypted. Not all requests on UIWebView are not https. You can't inspect element from iPhone/iPad/Simulator. You can do it in web in the mobile view (by using useragent).

break website out of iframe/uiwebview on iphone twitter client?

when we click on a link to our site, www.tekiki.com, from inside the twitter iphone client (search for tekiki.com on the twitter mobile client), the site appears in a boxed area.
is this an iframe or something we can break out of? we tried iframe-busting code, but it fails. we suspect this is a uiwebview. if true, can we bust out and open the site in safari/chrome via javascript?
When you click on a link within the official Twitter iOS app, it opens up a new modal view that contains a UIWebView. There is no way that you can break out of this view and into a different app since Twitter controls the experience. iOS only supports fast app switching via registered URL schemes such as fb://1234567890, not via javascript, etc.
The only way would be if they had an additional button that gave the user the option to open the page in a different app.

Titanium Studio Webview not letting me interact with website

Part of an app I am working on needs to access an external website to answer a few questions.
When that is needed, I am opening a web view and the URL set to this site. The page loads fine, but there is no way to interact. The textfields cannot be edited and the buttons cannot be clicked. To make sure it was not my website (works from iOS safari fine) I pointed the web view to www.google.com and cannot click the search button there either. Basically:
var webView = Titanium.UI.createWebView({url: 'http://www.google.com'});
win.add(webView);
win.open();
Is there some trick to being able to interact with the website through a web view? At this time I cannot use a native app and web service and need to get the app working with the existing website to fill out this form.
Titanium Studio 2.1.2 and iOS6
Maybe are you putting some View (Ti.UI.View) after putting the WebView in the Window?

Adding "Do Not Track" to iOS browser app with UIWebView

How would you enable/support "Do Not Track" for a browser app that uses UIWebView? Is this something that every app on iOS has to include by itself or is this already enabled in UIWebView?
Thanks!
Simple tools are coming like the one linked below -- add a line of JS at the top of the page and it turns off the tracking tags when the user has the DNT preference enabled. Should work on a mobile web view if you have a typical ad tag installation.
http://www.ensighten.com/news/blog/ensighten-privacydnt-free-tool-managing-compliance-do-not-track

Resources