-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support protocols different from http / https #10
Comments
Reading the source I see that supporting just
makes me think that is related to the I'd like to still suggest to make this module compatible with arbitrary protocols and instead reject URLs with no authority like Give that currently protocols are tags it does not seems like this could be accomplished without non-breaking change. Maybe type Protocol = Http | Https | Custom String To make this change less disruptive ? Alternative could be just adding known protocols to the list but I don't think that would be a good idea. It is also worth pointing out that electron apps often introduce custom app specific protocols, we at Mozilla also working with network protocol authors to allow adding them to Firefox via WebExtensions it would be unfortunate if Elm would not be an option for those use cases due to this limitation. |
Can you give examples of the other protocols you care about? I just need more information. I cannot design without any examples. |
In the context of
There are also few other projects that we may collaborate with but I don't feel comfortable discussing them publicly (yet). I think these are the things to consider in terms of design. Most of the custom protocols are semantically similar, which is being reinforced by the API that we (and others projects) provide for protocol implementers, which are:
Let me know if there is anything else that I can address. |
What I meant to imply that while I do have two or three protocols that I personally care about, I don't think that would necessarily provide required context. Which is why my last comment focused more on the semantics imposed on custom protocols as I think that would better inform design constraints. But if that assumption is incorrect please let me know and I'm happy to provide specific details per protocol basis. |
Will this fix ws and wss schemes?
The |
I've been creating html files of my presentations, e.g. |
Any Idea When the file:// could be working? I new to elm but I am willing to help. |
It would also be nice to support |
I have been using |
It might be worth considering if browser native |
I'm working with electron apps and just got here with the same issue. Is there any way we can enable |
This has bitten me as well while trying to update our electron based app to 0.19. |
@evancz Another use-case which currently doesn't work is hash-based routing in web extensions. The protocols would: chrome-extension:// and moz-extension://. |
Built a
Worked in Elm 0.18 with |
I would also like to see support for the Windows style |
Here are the schemes out of the registered ones currently requested in this issue:
|
I'd like to add mobile frameworks like Capacitor: |
There's also the Safe Network, |
I have run into this issue in trying to upgrade to 0.19 in our Cordova wrapped Elm app. In my case related to https://github.com/ionic-team/cordova-plugin-ionic-webview which uses This change from 0.18 blocks our upgrade and I cannot seem to see any way around it. |
We really don't like the hacks at all, but in our case we have to do it, since we use Elm 0.19 and we need to provide user with the self-hosted serverless version of our app. So here's our hack for the WebPack bundle ( plugins: [
new ReplaceInFileWebpackPlugin([{
files: ['<your-bundle-name>.bundle.js'],
rules: [
{
search: /var .=.\.fragment/,
replace: function(match) {
const varLetter = match[4];
const fragmentLetter = match[6];
return 'var ' + varLetter + '=' + fragmentLetter + '?' + fragmentLetter + '.fragment:{}';
}
},
{
search: 'case 1:throw new Error("Browser.application programs cannot handle URLs like this:\\n\\n "+document.location.href+"\\n\\nWhat is the root? The root of your file system? Try looking at this program with `elm reactor` or some other server.");case 2:',
replace: 'case 2:'
},
{
search: /return (\w+)\((\w+)\.location\.href\)\.(\w+)\s*\|\|\s*\w+\(1\)/,
replace: function(match, x, y, z) {
const href = y + '.location.href';
const toLocalhost = '\'http://localhost:8080/\'+' + href + '.substring(' + href + '.indexOf(\'index.html\'))';
return 'return ' + x + '(' + href + ').' + z + '||' + x + '(' + toLocalhost + ').' + z;
}
}
]
}]) |
Hi.
there could be another solution that i found recently. To get this example working in electron:
i used the
|
To add another datapoint, BeakerBrowser just hit v1.0.0-beta and uses the protocol |
To support this even more, the implementation for cordova-ios has changed recently (v6.0.0) and it doesn't support serving the app from And as already described, you can't simply write an Elm app for cordova-android either, the default implemenation uses the |
I'm currently looking into using Capacitor to publish an Elm app and looks like I'll also be blocked by this. |
I'm also looking into serving a local Elm app on iOS using capacitor. I have developed it fine for Android, but porting it to iOS is slowed by this issue. It's not possible to serve local assets (on iOS) using http(s) scheme, https scheme is reserved by the WKWebView for remote urls. |
@Strepto @ronanyeah I had the same problem with capacitor and came up with a workaround for a specific usecase: https://discourse.elm-lang.org/t/handling-custom-protocol-in-url-with-elm-was-forking-elm-url-to-enable-custom-url-protocol/7856/6 (beware: the "solution" is ugly...) That being said: at least iOS, MacOS and Android also have the ability to follow "app links" which may reference content in the application (e. g. a signup view). While not strictly necessary it would probably be convenient to simply hand the URL to the webview and letting Elm do the parsing. |
I'm trying to use |
+1 bump. Need this for |
+1 bump. Need this for |
I have originally reported elm/browser#20 but as far as I can tell reason is not in Browser.application but rather in the fact that following code explicitly deals with just http / https protocols
url/src/Url.elm
Lines 111 to 120 in 384b1dc
The text was updated successfully, but these errors were encountered: