I'm curious about how Discord manages to open server invite links directly in the app without that usual pop-up prompt that you typically see when a website tries to launch an app. For example, when I click on a Zoom link, I get a prompt asking if I want to open the app. But with Discord invites, it seems to bypass that step completely. Is this a cheat or an exploit? And is there a way to replicate this behavior?
4 Answers
Discord uses a WebSocket server connection within the client. When you click a Discord invite link, your browser sends a WebSocket request that the Discord client picks up. You can check this by opening your browser's developer tools, filtering for WebSocket communications, then clicking a Discord invite link. You should see a request that goes to a local IP. If you block it, refreshing the page will show that the client doesn't open. This is likely also why the client only pops up when you're logged into Discord in your browser—it verifies the source is legitimate.
When you access an invite link, it first resolves to trigger a registered protocol (like discord://) or uses universal app links that the OS or browser recognizes. This makes it possible to open the app straight away without prompting each time, especially if the browser remembers your choice from previous interactions. If you want to replicate this, you’d need to set up a custom URL scheme or universal links for your own app and redirect users to that link after processing any server data.
Discord doesn’t really ‘forward’ an invite link in the typical way. Instead, it handles the invites using a flow that goes from the web to an authenticated session and then seamlessly hands it off to the client, avoiding typical deep linking methods.

This isn't quite accurate. While protocols might be used sometimes, Discord primarily relies on WebSockets to handle invites.