locked
Issue with navigate to more than one domain within the same app RRS feed

  • Question

  • We would like to create an application for Excel, starting page of which redirects user to other domains (we have separate domain for each customer).

    We followed the instructions described here: https://msdn.microsoft.com/en-us/library/office/jj715716.aspx?ppud=4

    But they helped us only for Desktop version of Excel, in Excel Online we have problems with conversationId.

    If during redirect we keep only window.location.search - exception about null conversationId appears. 

    If during redirect we pass window.location.search and window.location.hash - we have error during call to ContextActivationManager_getAppContextAsync with message 'Failed origin check'.

    Manifest example:

    <?xml version="1.0" encoding="utf-8"?>
    <OfficeApp 
      xmlns="http://schemas.microsoft.com/office/appforoffice/1.1" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xsi:type="ContentApp">
      <Id>01eac144-e75a-45a7-b6d7-f1cc60ab0129</Id>
      <Version>1.0.0.0</Version>
      <ProviderName>XYZ</ProviderName>
      <DefaultLocale>en-US</DefaultLocale>
      <DisplayName DefaultValue="XYZ Excel app" />
      <Description DefaultValue="XYZ Excel app" />
      <AppDomains>
        <AppDomain>https://a.xyz.net</AppDomain>
        <AppDomain>https://b.xyz.net</AppDomain>
      </AppDomains>
      <Hosts>
        <Host Name="Workbook" />
      </Hosts>
      <DefaultSettings>
        <SourceLocation DefaultValue="https://xyz.net/index.html" />
        <RequestedWidth>400</RequestedWidth> 
        <RequestedHeight>300</RequestedHeight>
      </DefaultSettings>
      <Permissions>ReadWriteDocument</Permissions>
      <AllowSnapshot>false</AllowSnapshot>
    </OfficeApp>
    

    Tuesday, March 31, 2015 10:40 AM

All replies

  • Hi mfesenko,

    >> But they helped us only for Desktop version of Excel, in Excel Online we have problems with conversationId.
    I made a simple demo with as the link, and it worked both in Desktop and Excel Online. What do you mean with "conversationId". I test with the code below:

        <script type="text/javascript">
            $(document).ready(function () {
                $("#get-data-from-selection").click(function () {
                    window.location = "http://www.google.com";
                });
            });
        </script> 

    It would be helpful if you could share us a simple demo to reproduce your issue.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, April 1, 2015 1:01 PM
  • Hi Edward,

    Thank you very much for your response.

    Main problem is that after redirect we will be on the page, that wants to behave like app for Office and have access to Office JS api. But initialization of Office JS api fails.

    Here is sample code, used bubbles application as example:

    <html> <head> <title>Redirect test</title> <script src="https://appsforoffice.microsoft.com/lib/1.1/hosted/office.debug.js" type="text/javascript"></script> <script type="text/javascript"> Office.initialize = function (reason) { console.log('Office.initialize called'); } var APP_URL = "https://bubbles.azurewebsites.net"; function redirect() { performRedirect(APP_URL); } function redirectWithSearch() { performRedirect(APP_URL + window.location.search); } function redirectWithHash() { performRedirect(APP_URL + window.location.search + window.location.hash); } function performRedirect(url) { console.log('url = ' + url); window.location.href = url; } </script> </head>

    <body> <button type="button" onclick="redirect()">Redirect to bubbles app</button> <br/> <button type="button" onclick="redirectWithSearch()">Redirect to bubbles app with search</button> <br/> <button type="button" onclick="redirectWithHash()">Redirect to bubbles app with search and hash</button> </body> </html>


    Beat regards,

    Mary



    • Edited by mfesenko Wednesday, April 1, 2015 4:41 PM
    Wednesday, April 1, 2015 4:39 PM
  • Hi mefesenko,

    I made a simple demo with your Manifest and the html, it would not work in desktop. If I modify the Mainfest file like below:

      <AppDomains>    <AppDomain>https://bubbles.azurewebsites.net</AppDomain>
      </AppDomains>

    It would work in desktop. It would not open in a new webbrower. If I change it to excel online, it worked correctly. Could you share us a simple demo to reprodce your issue?

    Best Regards,

    Tony

    Help each other


    • Edited by Tony---- Friday, April 3, 2015 7:27 AM
    Friday, April 3, 2015 7:13 AM
  • Hi, Tony

    I added the same manifest with link to bubble app in AppDomains sections into apps directory on SharePoint Online.

    Sample page from my previous response is on my local machine, I configured nginx to access it by url:

    https://xyz.com:9080/test.html.

    Here is a video of running all three options of redirect: 

    https://tmei3-my.sharepoint.com/personal/admin_tmei3_onmicrosoft_com/_layouts/15/guestaccess.aspx?guestaccesstoken=28Yb0CTTJ5R8cKZlNnWetW4e5l%2fv1l01tRE0hkKMZD8%3d&docid=0572386a503aa4e0dbfa1c638b62be598

    Problem is that AFTER redirect happens - the application fails to initialize Office JS api, so it does not work.

    Friday, April 3, 2015 3:03 PM
  • Hi mfesenko,

    >> Problem is that AFTER redirect happens - the application fails to initialize Office JS api, so it does not work.

    In my test, I could reproduce your issue. In Office Web app, the Office initialize will fail with redirecting.

    First, single page app is a recommend way to develop Apps for Office. And according to my test, Office Web App has a more strict way to verify the App URL (assign the search and hash would not work).

    In my option, currently, I will suggest you changing the DOM elements instead of redirecting for UI updating.

    Hope it will help.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, April 8, 2015 8:52 AM