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.
Related
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.
I've found two options to open my app from a Safari web page: a custom URL scheme created in my app project's Info.plist or Apple's Universal Linking. Obviously the custom URL scheme is the easiest one to set up, but the problem I'm having with this is that Safari shows a confirmation window asking "Open myapp?" first and the user has to tap OK before the app actually opens. I want my app to open automatically as the scheme is opened, and I'm being told the only way to do this is through Universal Linking (please correct me if this is not true). If this is true, however, I would like to know if it's possible in any way to put the required apple-app-site-association file on a http:// domain instead of https://? According the official Apple documentation the format of a correct Universal Link starts explicitly with https:// but my domain name can't be loaded on https:// without redirecting a few times and that messes up the web services I've written to execute other tasks in my app. The two main questions I'm left with after this issue:
1) Is it really impossible to work around the confirmation prompt using a custom URL scheme (myscheme://)? If it's not impossible, how can I do this?
2) If I have to use Apple Universal Linking, can I use a http:// domain? If so, how do I do it? Right now if I load up the universal link, it just shows the dictionary inside the apple-app-site-association file, which I'm pretty sure is not supposed to happen. I'm told it's supposed to send a NSUserActivity object to my app delegate. How can I accomplish this with a http:// link?
It is not possible to trigger a custom URI scheme without showing an alert to the user. This used to be possible in iOS 8, but iOS 9 started showing the alert for all apps. And iOS 10.3 has extended that even to the App Store itself. You cannot bypass this. Universal Links were created to replace URI schemes for this behavior, so you do need to use them instead.
From your description, I believe you may be misunderstanding how Universal Links work. To answer the literal questions you asked first, no the Universal Link URL itself does not need to be on the https:// protocol, and yes, the apple-app-site-association must be served over https:// without redirects.
However, it sounds like you're trying to serve the content of the apple-app-site-association file for every Universal Link. That is not the correct implementation — the AASA file is hosted only at https://example.com/apple-app-site-association, and iOS automatically retrieves it when the app is installed. After that, any URL on example.com that matches the criteria in the AASA file will be eligible for Universal Links.
All of that said, you really don't want to built out this system on your own. I suggest looking into Firebase Dynamic Links or Branch.io (full disclosure: I'm on the Branch team).
Is it really impossible to work around the confirmation prompt using a custom URL scheme (myscheme://)? If it's not impossible, how can I do this?
That is possible with some hacky tricks and BAD user experience. It requires user to press "add to home screen" button, so I don't recommend this solution in most cases.
set your app scheme like myapp
create the following html file and put it into the web
window.onload = function() {
if (("standalone" in window.navigator) && window.navigator.standalone) {
window.location.href = 'myapp://open'
}
}
open the html file with safari and "add to home screen"
open the home screen icon and your native app will launch
The point is the meta tag.
<meta name="apple-mobile-web-app-capable" content="yes" />
Without this, safari will launch and confirmation prompt will appear.
I'm confused. I think I've fundamentally misunderstood how to use Open Graph stories + deep-linking across my iOS/Web app. I'm hoping someone can help me clarify things. Here's what I have:
A web app set up that takes http://mywebapp.com/?video_id=XXXXXXXX
Properly configured meta tags for app-links
An iOS app with similar functionality that communicates with an API
Facebook sharing on the iOS app.
Here's what I expect:
See a link (ON MOBILE) in either the Facebook app or Safari, when I tap the link get the 'Install App' or 'Open in App' UX
I experimented with simply linking to 'http://mywebapp.com/?video_id=XXXXXXXX'. It doesn't work UNLESS I go to the object debugger (https://developers.facebook.com/tools/debug/og/object/) and 'Fetch New Scrape Information' for that video_id (i.e. it doesn't work dynamically, the page has to be scraped.) I also tried using Open Graph sharing with a contentURL and a combination of custom objects/actions/content/stories and at no stage did the Facebook app offer to open up the iOS app (again, unless I scraped the page in advance).
Have I misunderstood what is possible? I take it that if I scrape + link to http://www.mywebapp.com it'll work fine, but I want to have custom stories like:
'User X played video 'Y' using MyWebApp', but that kind of dynamic sharing WITH a concept of deep linking/app link/whatever seems impossible. Does anyone have any experience with this?
I found a lot of tutorials about opening an app by a custom url scheme like:
myappname://
Thats nice but it would be great to open an app by registering the real app domain over the http link like
http://www.myappdomain.com/blablabla
So - for example - if a visitor comes to a webpage (on her/his mobile) it is normally opened in the browser, excepts the installed app is listening to the opened URL and opens itself instead of the browser.
How is this done (i've seen this at another app). Any help would be great. Thanks in advance!
It is a new feature in iOS9. It is explained in the WWDC15 talk Seamless linking to your App.
You could also add a small piece of javascript to each page that opens your custom URL-scheme.
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.