OfficeDev / microsoft-teams-library-js

JavaScript library for use by Microsoft Teams apps
https://docs.microsoft.com/microsoftteams/platform/
Other
429 stars 197 forks source link

microsoftTeams.pages.navigateCrossDomain does not work in mobile Teams on Android #1748

Open denis111 opened 1 year ago

denis111 commented 1 year ago

First of all, this is not a duplicate of https://github.com/OfficeDev/microsoft-teams-library-js/issues/650 because this time is for teams-js v2.x.

I'm trying to redirect the user to another domain which is in the validDomains list in manifest. It works just fine without any problem on Teams desktop but not on my Android device (Android 12, Xiaomi Mi 10T). With this example code with teams-js v2.11.0:

const pages = microsoftTeams.pages;
console.log("Trying navigating cross-domain...");
let navigated = false;
pages.navigateCrossDomain(url) // url var has value of one of validDomains
  .then(() => {
    navigated = true;
    console.log("navigated cross-domain");
  }).catch((err) => console.log("Error navigating cross-domain: " + err))
  .finally(() => {
    console.log("navigated cross-domain: " + navigated);
  });

I only see "Trying navigating cross-domain..." and nothing more in the debug console. The promise never resolves, it never enters into then, catch, nor finally, just does nothing. On the desktop it works like expected without any problem and I can have context and everything in redirected page. This is blocking for us because we can't pass marketplace certification if our Microsoft Teams app doesn't work on mobile devices. Thank you for any help or suggestion.

ghost commented 1 year ago

Hi denis111! Thank you for bringing this issue to our attention. We will investigate and if we require further information we will reach out in one business day. Please use this link to escalate if you don't get replies.

Best regards, Teams Platform

ChetanSharma-msft commented 1 year ago

Hello @denis111 - Thanks for raising your issue. We will look into it and let you know the updates.

Nivedipa-MSFT commented 1 year ago

@denis111 - We have tested this below code at our end.

const pages = microsoftTeams.pages; alert("Trying navigating cross-domain..."); let navigated = false; pages.navigateCrossDomain("https://www.bing.com/") // url var has value of one of validDomains .then(() => { navigated = true; alert("navigated cross-domain"); }).catch((err) => alert("Error navigating cross-domain: " + err)) And we have added "*.bing.com" in validDomains section.

On Android mobile weare able to see "Trying navigating cross-domain..." and nothing more in the debug console. The promise never resolves, it never enters into then, catch, nor finally, just does nothing. On the desktop Teams client it works like expected and redirected to the url.

We have tested this on Teams desktop client version 1.6.00.12154 (64-bit) and on Android version 12.

Teams Desktop Client

NavigateCrossDomain-Desktop.webm

Android Teams

https://github.com/OfficeDev/microsoft-teams-library-js/assets/92150070/7adecb2d-b5b4-4aea-ae11-7cf4e1e4cdd7

We have raised a bug for the same. We will let you know once we get any updates on it.