Is there a way to simply go to a new webpage in Elm, similar to clicking on a link?
I have a button
that when clicked I want to take the user to another webpage. I know I could make that an a
element and use CSS to style it like a button. However, I'm using elm-mdl
to create material design lite buttons and I'd like to know how to do this regardless.
I've tried creating a GoTo String
Msg
and firing that on the button click with Button.onClick (GoTo "newpage.html")
, but I don't know what to put for the Cmd
. I tried the following:
GoTo url ->
( model, Navigation.newUrl url )
But that only makes the URL in the address bar change, the user doesn't actually go to the new url... I could use a port and write some simple JavaScript code to call window.location.href = 'newpage.html'
, I'm just hoping there's a simple standard Elm way to do this.