element-hq / element-hq/element-meta
Handle permalink_prefix for mobile clients
- Dominant language
- No language data
- Stars
- 112
- Forks
- 25
- Avg merge
- 6h 6m
- Merged PRs (30d)
- 4
Description
### Your use case
#### What would you like to do?
If `permalink_prefix` is changed to point to the URL of a hosted Element instance, then when sharing from the web, links take you to said Element instance instead of matrix.to, as expected.
On mobile, going to the URL of the hosted Element instance (e.g. https://matrix.mit.edu) takes you to instructions on how to use the Element app. However, going to the URL of a room (i.e. https://matrix.mit.edu/#/room/#inexistent-room:matrix.mit.edu) takes you to the desktop version of the Element web client.
I think it is unreasonable to expect people to use the desktop version of Element on their phones.
#### Why would you like to do it?
Users on desktop would share links to people, and mobile users would click the links
#### How would you like to achieve it?
It would be nice if either:
1. This took you to matrix.to so you could open the Element app on mobile
2. This took you to the instructions but in a way that uses deep links or specific instructions so that users can download the Element app, change their homeserver, and join the desired room.
### Have you considered any alternatives?
I have a workaround for my server:
In nginx:
```nginx
location = / {
if ($http_user_agent ~ iPhone|Android) {
rewrite .* /mobile redirect;
}
}
```
In `mobile/index.html`:
```js
let hash = window.location.hash;
if (!hash || hash === "#/welcome") {
window.location.replace("/mobile_guide/");
} else {
if (hash.includes("#/room/")) {
hash = hash.replace("#/room/", "#/");
}
window.location.replace("https://matrix.to/" + hash);
}
```
While this alternative is faster than loading the source code of Element web on mobile and doing a client-side redirect, it would be nice if this was a feature, so people with a similar setup have this work by default.
### Additional context
I assume this would also be useful for your Element Web Services clients (schools or enterprise) who wish to make using their homeserver as smooth as possible, without having users clicking invites be greeted with a long list of clients and a choice of homeserver. In other services like Discord, invite links work for everyone no matter their type of device. This is true for Element as well, but not yet when someone opts to change the `permalink_prefix`.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing how permalink_prefix is handled for room URLs and review the mobile/index.html workaround, including its /mobile_guide/ and matrix.to redirects. Done means hosted Element room links no longer force the desktop client on phones, instead providing mobile app deep-link behavior or clear mobile setup instructions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nginx
- Domain
- mobile-dev, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100