How to redirect to SharePoint hosted app when user lands on site collection
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.
April 16th, 2015 2:42am

<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>
Free Windows Admin Tool Kit Click here and download it now
April 16th, 2015 6:24am

Hi,

Thanks for your sharing, would be helpful to those who stuck with the similar issue.

Thanks,

Patrick Liang 

April 16th, 2015 10:31pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics