How to open saved web app using JavaScript? - javascript

I'm new to PWA (Progressive Web App) and using Angular. I have configured a service worker module as described in the Angular docs. Everything is working fine. On Android, the user is able to add the app to the home screen and it is working on offline as well. But I'm unable to find the functionality to open the saved web app by triggering an action in the browser.
Let's say https://pwa.com is a domain and I want to open saved app (on the home screen) from another domain like https://example.com or from another route on the same domain like https://pwa.com/openApp by clicking on a button. Is there any possibility to do this?

Looks like this is possible for Android: https://developers.google.com/web/fundamentals/integration/webapks
But doesn't seem like it works for iOS
https://medium.com/#firt/progressive-web-apps-on-ios-are-here-d00430dee3a7

Related

How to open a mobile app (Android or iOS) from a web app using Javascript/PHP

I would like to create a button on my PWA (which could run on an Android or an iOS device) which opens another particular application installed on a device (in this case, the app "VerificaC19", which is needed to verify a Green Pass certification.
Is there any Javascript/PHP code I could use to create a button in the PWA running on the browser which automatically opens the application?
This seems to be answered here for iOS.
You need to know the URL scheme of the app. Specific to iOS and Android there can be different URL Schemes registered with the target app.

Is it possible to open a facebook group link in facebook app from android webview application build by android studio

I want to know is it possible to open a facebook group link in facebook app from android webview application build by android studio.
is there any html and JavaScript for that.
With webview in android studio, you can only open links inside your app and not outside.
In your case, you want a facebook group link to be opened in the facebook app which may not be possible using Webview.
That's why you need to use WebViewClient. You need to override shouldOverrideUrlLoading method and start an intetn with the package "com.facebook"
Check this answer: https://stackoverflow.com/a/50293855/12802591
You may need to test if the user already had facebook app installed then open the group link there, if not it will open the group link inside the web view.
Another useful link :
https://stackoverflow.com/a/54589702/12802591
Let me know if it works !

How to open an external app in Cordova/Ionic?

I'm working on an ionic app. In my app I want to have a button that will open another app. I tested the hyper link in safari and the link opens the app correctly, but when I click the button inside my Ionic app, it's not working. The Xcode reports
Failed to load webpage with error: The URL can’t be shown
Any suggestions?
If you are trying to use externally hosted web application in your cordova application, check out cordova-hosted-webapp-plugin. The plugin enables using content hosted in a web site inside a Cordova application by providing a manifest that describes the site. Also it lets you use the features of Cordova plugins too.
But if you are trying to just invoke the external web URL from your cordova app, you can make use of cordova-InAppBrowser-Plugin which opens the web URL inside the app itself.
You can also check out cordova-themeable-browser-plugin which is almost similar to InApp browser plugin and provides more control on the browser elements available in the UI. Hope it helps

Tell if android app is installed using javascript or jquery

I have an android app that can be accessed through a web browser too. I need to put a banner to let the user install the android application. How can i tell (if the user enters to the application through the web browser) using javascript or jquery, if the android app is already installed on his mobile phone?
All i want to do is: If the user clics the banner and the app is already installed, open the android app. Otherwise, redirect the user to the playstore to let him install the app.
Let's say your app is uploaded on both Apple AppStore and Google Play stores.
You need to:
Sniff in your webpage which OS is installed from the device accessing your page
good link to find how => here
Enable deep linking to listen for exactly same link from your mobile native app
for Android you need to register your main activity or any other activity to listen for these links
for iOS - no idea honestly, look around or find a 3rd party service
code for Google Play with deep link. And the deep link is same as your website page you want to cache/index in Google Search (or any other search engine)
sample link to index/use => http://my_website.com/results
// below snipplet need to be for Android devices only
// i.e. need to sniff and have if/else validation for Android, iOS, desktop and so on
// will call with 25 mills delay in case deep link fails, i.e. no installed app
setTimeout(function () { window.location = "https://play.google.com/details?id=com.foo.myapp"; }, 25);
// try to load the deep link URL
window.location = "http://my_website.com/results";
repeat above for iOS and desktop/Windows Mobile
Additional advantage of above is the full app indexing without the lame App Indexing excuse from Google (min sdk no more than 17, Chrome for Android availability and so forth limitations).
There is no way to detect if an app is installed using Javascript.
However you can get the behavior you describe and you don't even need any javascript:
Choose an URL for your app on a web server you own and make the banner link to it.
Set this web URL as a deep link handled by your app by specifing it in your app's manifest. It should open the main Activity.
On your web server, configure this URL to redirect to the Play Store URL of your app. Optional: if your app is also on iOS, you could detect the iOS browser and display something else.
If the app is installed it will handle the URL and open, otherwise the browser will follow the link and the redirect and the Play Store app will open to handle the Play Store URL to your app.

Open non-whitelisted URLs in Cordova in ChildBrowser rather than main Webview

I'm trying to implement the official Twitter and Facebook share buttons in my Cordova/Phonegap app, and I'm running into major difficulties with them. Both of them attempt to load an iframe element to display their buttons, which works, but clicking either of them causes them to open in the Webview, with no way to open them instead in the ChildBrowser. This becomes an issue when the user is done sharing but can't go back to the app due to a lack of navigation buttons.
Is there some way to open a list of URLs in ChildBrowser by default instead of Webview?
Well you can use the:
ChildBrowser.showWebPage();
command to open non-white listed URL's.
Coming in 2.3.0 we will overload window.open() in so that you can specify whether or not you want the url opened in the main web view, the OS browser or the special in app browser that does not have access to the Cordova API.

Categories