Links open i browser instead of app

For troubleshooting questions, please post in the following format:

Summary
Links to specific messages or channels in Mattermost open in the browser instead of the app
Steps to reproduce
copy link; paste into wherever, click the link

Expected behavior
The channel/message opens in desktop

Observed behavior
The channel/message opens in browser

Hi @joacimsvensson and welcome to the Mattermost forums!

What Mattermost server version do these links point to?

Hi @agriesser! We are running 7.7.1 team edition, self-hosted

Hi again,

The ability to specify a landing option has been added recently and you maybe clicked on the browser variante and on save, which causes the browser to save your preference and not redirect you to the deskto app.
When you look at the local storage of your Mattermost instance, you will see two keys responsible for that, namely:

__landing-preference__<yourdomain>
__landingPageSeen__

When you delete the two, you should (upon your next click on the link) see this page again, where you can then choose to open links for this instance using the desktop app:

Hi! I didn’t follow where those keys are located?

They are in your browser’s local stoarge.
Access your Mattermost domain, then open the developer tools (usually with the F12 hotkey), then there’s a section called “web storage” (or any localized version of it which should look like this then:

Ah, thanks. Unfortunately, none of those keys are in the local storage.

That’s interesting - they should be there as soon as you access the page for the first time. Can you try to open the webinterface to your Mattermost server with a private browsing tab to make sure that no cookies or other local caches interfere here?

There are definitely a lot more keys, those landingpage ones as well, when I browse to community.mattermost.com. Could it be related to the hosting options? We’re self-hosted

My instance is also self hosted and I can see them there - this is (AFAIK) only depending on the version installed, but since you said you’re already on 7.7.1, the option should be available.

Bummer, it doesn’t appear to be there for me.

Can you try to access https://mattermost.yourdomain.com/landing? (The /landing at the end should bring you immediately to the landing page where you can decide what to do with such links)

Small step forward, it did bring me to the landing page so I can save my choice and I can verify that the keys are indeed there now. However the links are still opening in the browser, for my own server as well as for https://community.mattermost.com/

Interesting, so the cookies are being set by the landing page and you can see them, but they’re being ignored?
Just one wild guess here, but can you confirm that your SiteUrl configuration setting is set to the URL your web- and desktop apps are connecting to, including the protocol and ports? So if your server is reachable via https://yourdomain.com:8443/mattermost, f.ex., your SiteUrl configuration value also needs to be set to this value.
Is there any reverse proxy in front of the Mattermost server that might tinker with the cookies being sent back and forth between the client and the server?

@joacimsvensson

Small step forward, it did bring me to the landing page so I can save my choice and I can verify that the keys are indeed there now. However the links are still opening in the browser, for my own server as well as for https://community.mattermost.com/

We are having exactly the same both - problem and the result (of deleting those preference keys), the landing page with the choice appears , but the links continue to open in browser.

Have you been able to resolve this issue?

Regards, Ilya

Same here. only the key landingPageScreen was present at first, i deleted it and then got the prompt whether i prefer browser or desktop app again. i saved and this time both keys were set. however, this only works exactly once (immediately after saving the preference). all links opened afterwards are again opening in browser without redirect. [we are also self hosted]

I can confirm this bug, I tested that if logged in, and preference has been set, the checking of opening on app or not, will be bypassed

mattermost/webapp/channels/src/components/root/root.tsx

From

        // Only show the landing page once
        if (BrowserStore.hasSeenLandingPage()) {
            return;
        }

to

        // Only show the landing page once
        if (BrowserStore.hasSeenLandingPage()) {
            // return;
        }

will ensure that the “landing” code in mattermost/webapp/channels/src/components/linking_landing_page/linking_landing_page.tsx

is triggered, and then the app will open, based on the preference. However, this is just a workaround to find the root cause. The logic needs to include such that if the preference has been set, and is set to open on mobile, it should proceed to the landing code. the return should only apply if have set to continue in browser.