When I click on a link within my WebView, it behaves as expected - it opens the link within the WebView.
However, if an app can handle that link, I would like to open that app instead. For example, if I tap on a Twitter link, I would like it to open Twitter, else open in-app.
This is how Google Chrome on Android behaves. This is also how WKWebView, the iOS equivalent of WebView, also behaves.
How would I go about implementing that? I have attempted to implement the solutions here but now my app always wants to open the system browser.
Deep Links as handled by OS itself. You just need to implement it properly. For example, in Android if you want to open the following url
http://twitter.com/intent/tweet?text=YOUR_TEXT
it will open the twitter app if the app is installed in your phone. Otherwise it will be opened in your browser.
But in case of iOS you have to specify the URL Scheme for opening in another app. Check the following url
twitter://post?message=YOUR_MSG
So when implementing this SO answer, you should also consider about the URL Schemes.
You should also keep in mind that webview in the application are implemented so that you don't have to open the browser app and no urls are exposed. If you want to open another app, you must consider opening the url in browser from your app so that OS can handle the rest.
Related
For example, maybe the user can choose the app from the ones that are installed on the device or the ones that are currently running in the background. Or maybe inspect the current page of the app running in the background, for example inspect the register page of Facebook app, then login on Facebook and inspect the home page of it.
Something like the Uiautomator but running on android..
I am trying to implement app links into my app to make sure that other malicious apps cannot register for my URL.
I read the guide on app links here https://developer.android.com/training/app-links/verify-site-associations.html and I have mostly understood it. But one thing which is not clear to me is how can I prevent malicious apps from receiving my domain links if my app is not installed.
Consider this scenario.
1. My app is not installed on the user's device
2. Some malicious app is and it knows the URL that my app handles
Wouldn't this launch the malicious app and it can intercept my URL if the user selects that app from the disambiguation dialog? Is there any way to prevent it?
I understand that android:autoVerify="true" will trigger the domain verification when the app is installed, but what if the app is not installed?
Whether the user has the app installed or not, the "illegal" app won't be able to handle your links since it has not access to your domain in order to save there the needed JSON file. Am I clear?
There is a JSON file that is required during App Link configuration, that has to be uploaded to your server (that includes your app ID), through which your web-app basically says to the Android OS 'this is my counterpart on Android devices, I authorise it to handle these URLs'. Since app IDs are unique, there is no way another app can meet those conditions.
To quote the docs:
An Android App Link is a deep link based on your website URL that has
been verified to belong to your website.
So, although an app may register an <intent-filter> it ALSO has to be verified by the website whose URL it's trying to handle. And this happens on the server, so, out of the reach of a mobile client.
See also HERE for a more detailed explanation.
There are very similar questions on the board but I still didn't find satisfying results for my topic.
I have to implement links on our website to redirect to Facebook and Google+ for check-ins to my company.
It should be possible to click on the link on the website and my smartphone (Android) should ask if this link should open for example the Facebook App or the Link to the Site in the Smartphone browser.
Is there a link that the smartphone can parse:
-the app is installed, would you like to open the G+ or Facebook app
-or open the web-browser from the smartphone
The link should also redirect me on the Facebook/G+ site of my company. So after the user chooses the app or web browser he/she should be able to check-in with one click.
I think there are already standards for links like this. I just can't find any satisfying
results for my problem.
I am currently testing with Android but it would be cool if the links would be also working with iOS :-)
This would be a similar question.
I added this html snippet to my page:
href="fb://page/77664937087"
The problem is I have to parse if the user has installed the app or the browser. In this case the app would open. But I need some sort of if-statement. I am no javascript pro so I need some help for this.
And I don't want to implement 2 seperate links for app or browser.
You can use this method of UIApplication to check whether the app is installed:
- (BOOL)canOpenURL:(NSURL *)url NS_AVAILABLE_IOS(3_0);
If can not you can open the url using following code:
NSString *url = #"xxxxxx"; //your link here
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
My question is just as the title indicates.
I have a JavaFX app, and need to open a browser window. After opening it, I want to be able to communicate from the browser back to the app that opened it.
For example, if I opened the default browser window like this:
URI u = new URI(url);
java.awt.Desktop.getDesktop().browse(u);
Three options:
Through Javascript
Using javascript, and the window name you could access any window.
E.g. See: https://stackoverflow.com/a/16525481/1688441
Through Ajax Calls and a Server/Database
As another user answered, communication could be done with an intermediate server.
Third party library
The only other thing I can think of is using a 3rd party library to get the window within Operating System, though not much more I can suggest.
You can communicate back and forth with a WebView component. See http://docs.oracle.com/javafx/2/webview/jfxpub-webview.htm
If you are launching a page in the hosts browser, you'll need to develop a server based method to communicate.
I'm searching for a way to interact with different android browsers.
My intention is to get the URL of the website that is opened by the browser.
My app should run in background and give an alert when a specific url is opened, for now this is for testing and to learn more about android.
Is there any way to tell the browser to pass the url-string to my app everytime a new url is entered?
I've already got the idea to implement a local proxyserver wich checks all http-requests for a specific url, but is there a better way?
aditionally this should work with every browser not just the standard one but also eg. firefox or dolphin.
I already searched the last few days but couldn't find an answer....
Yes, you can do this! Check out http://seleniumhq.org/ for how to automate a web browser.