Links from Microsoft Teams no longer open in the expected browser #369
Replies: 5 comments 6 replies
|
Perhaps if there is a log on what Finicky processes it may shed some light? |
|
It looks like Teams opens links to a safe-link checker (maybe this is dependent on the organisation) I seem to be able to redirect all links by matching https://statics.teams.cdn.office.net/* |
|
If it helps, this has stung me a bit. When you add a Teams meeting to a calendar invite it now comes with two links, both wrapped in safelinks. The first opens the Teams help page redirect and the second opens the actual meeting. I've found a bunch of tools (BusyCal was one example) are configred to grab the first link in a meeting invite, meaning you always ended up at the redirect page. I initially assumed this was Finicky enable to untangle the link in the safelinks but discovered this twist too. |
|
Here is an example that works for v4: export const msTeamsHandlerEgress: BrowserHandler = {
match: (url: URL, { opener }) => {
return (
opener?.bundleId === MSTEAMS_APP.bundleId &&
url.host === 'statics.teams.cdn.office.net' &&
url.pathname.startsWith('/evergreen-assets/safelinks/1/atp-safelinks.html')
);
},
browser: FIREFOX_APP.bundleId,
}; |
function isValidUrlObject(url) {
try {
return Boolean(url && url.host && url.hostname && url.protocol);
} catch {
return false;
}
}
const msTeamsSafelinksRewriter = {
match: (url) =>
isValidUrlObject(url) &&
url.hostname === "statics.teams.cdn.office.net" &&
url.pathname.startsWith("/evergreen-assets/safelinks/"),
url: (url) => {
try {
// Extract the actual URL from the safelinks wrapper
const actualUrl = url.searchParams.get("url");
if (actualUrl) {
const decodedUrl = decodeURIComponent(actualUrl);
log(`Extracted URL from Teams safelink: ${decodedUrl}`, `Original: ${url.href}`);
return new URL(decodedUrl);
}
log(`No URL parameter found in Teams safelink: ${url.href}`);
return url;
} catch (error) {
log(`Error extracting URL from Teams safelink: ${error.message}`);
return url;
}
},
};I've not tested this at all. I fixed it personally by parsing it in my calendar app (ItsyCal) and extracting the Teams URL there. That code is here if it's at all helpful. |
Uh oh!
There was an error while loading. Please reload this page.
This used to work, but Microsoft must have changed how they launch URLs.
Before: links would go to Finicky and open in the expected browser.
Now: links presumably go to Finicky but always open in Safari and Safari stays in the background.
Have you tried creating configuration for this application?
I tried changing default browser to Edge, and links from Teams correctly opened in Edge and Edge came to the foreground.
I tried changing default browser to Safari, and links from Teams opened in Safari and Safari stayed in the background !
I tried changing default browser to Finicky and the same incorrect behavior remained.
What application are you trying to set up
I want to click links on Microsoft Teams and have them open in the correct browser per my configuration, which works correctly from other applications including Microsoft ones.
All reactions