0

Is it possible to redirect user directly to SharePoint hosted app when he enters to the site collection? Currently user have to click on the app to navigate to SharePoint hosted app and I would like them to directly navigate to app without any clicks required.

1 Answer 1

0
<script type="text/javascript" >
SP.SOD.executeFunc('SP.JS', 'sp.ClientContext', function() {
var ctx = new SP.ClientContext.get_current();
var web = ctx.get_web();
var appInstances = SP.AppCatalog.getAppInstances(ctx, web);
ctx.load(appInstances);
ctx.executeQueryAsync(
    function() {
          window.location = 
 appInstances.getItemAtIndex(1).get_appWebFullUrl();

    },
    function(sender, args) {
        console.log(JSON.stringify(args));
    });
});
</script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.