We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Launch App from browser

Thread ID:

Created:

Updated:

Platform:

Replies:

124090 May 15,2016 03:26 PM May 17,2016 09:01 AM Orubase 1
loading
Tags: Orubase
Sagi Karni
Asked On May 15, 2016 03:26 PM

I'm trying to launch my app in case it is installed and fallback to my website if tbe the app does not exist. (got some insights from  : http://stackoverflow.com/questions/13044805/how-to-check-if-an-app-is-installed-from-a-web-page-on-an-iphone

I was able to launch the app using custom url scheme , but was only able to so when there is user interaction (e.g. user clicks a button/link) :

     <a onclick="window.open('myapp://foo=bar', '_system')">Launch myapp</a>


However When using 

  window.open('myapp://foo=bar', '_system');

or 

 window.location = 'myapp://foo=bar'

without user interaction (e.g. on window load / document ready) the app does not launch.

Is this expected ?

Any workarounds ?

Thanks
Sagi

Vignesh Kumar D R [Syncfusion]
Replied On May 17, 2016 09:01 AM

Hi Sagi, 
Syncfusion Orubase is integrated with Cordova. So we can use cordova plugins also. 
Please install InAppbrowser initially and then proceed the following steps. 
1.       Open command line and navigate to application directory  
 cordova plugin add cordova-plugin-inappbrowser” 
 
Syntax for launching particular application: 
window.open('https://www.facebook.com', '_system'); 

We achieve this requirement using one of the following use cases.  
Use case 1: 
Here we use Mobile slider control. When the slider value will change above 50 means 'myapp://foo=bar' URL is loaded. Also initially set the below highlighted value is above 50, that particular URL will open when the page is loaded.  
<span> Change the Slider value: If the value above "50" means another url will open </span> 
    <div id="slider" data-role="ejmslider" data-ej-change="onChange" data-ej-value="50"></div> 
 
    <script> 
        function onChange(args) { 
            if (args.value > 50) 
                window.open('myapp://foo=bar','_system'); 
        } 
    </script> 
 
Use case 2: 
Here we use Mobile Button control. In the below code the button click event is triggered when document ready. So when the page is loaded, at the time click event triggered and that particular URL is opened. 
    <input id="button" type="button" data-role="ejmbutton" data-ej-text="Launch myapp" /> 
 
    <script> 
        $(function () { 
            $("#button").click(function () { 
                window.open('myapp://foo=bar','_system'); 
            }); 
            $("#button").trigger('click'); 
        }); 
    </script> 
 
Note: 
Please refer the below link for App availability ensuring 

Regards, 
Vignesh Kumar DR 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;