What is the Elm 0.19 equivalent of Navigation.modifyUrl


There is a portion of my page that is being managed by Elm. It handles some filtering. When the filters change, I want to modify the current URL of the page (so filter state is remembered if someone bookmarks the page, for instance).

In Elm 0.18, I used Navigation.modifyUrl and it worked great. It doesn’t look so straightforward in 0.19. In 0.19, it looks like these sorts of methods are only available if I create a Browser.application. However, creating a whole application seems to mean that I’m handing the entire page over to Elm and I don’t want to do that. The portion that is managed by Elm is a tiny fraction of the page and I don’t want to figure out how to move all of the other code (that is server-generated) into Elm.

Is it possible to create a Browser.application that doesn’t take over the whole page? Is there a way to use the Browser.Navigation methods outside of an application?

Any thoughts or ideas would be appreciated.


The suggested solution is using ports. See more details and a explanation here: https://github.com/elm/browser/blob/master/notes/navigation-in-elements.md


Thanks Laurin. Bummer this feature was removed in Elm 0.19. I don’t think I’ve ever worked on a SPA where at least some of the page wasn’t generated by the server and not the client.


This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.