Over on SO I just posted an answer (see below) to the question there.
Your case is different, because you do not have want to navigate away based 
on a click, but from your update function.

In your case, I would suggest to use a port:

   - Send the url as a string through a port to javascript
   - In javascript, call `window.location.href = urlFromElm`


-----
To make any item a clickable link (similar to providing a href to an a 
element) there is hack that you could use:  
Supply a one-liner of javascript to an Elm style attribute. Using 
`attribute` from the `Html.Attributes` library.

You could make your own helper that does the redirect:

    redirectTo : String -> Attribute msg
    redirectTo destinationUrl =
      attribute 
        "onclick" 
        ("window.location.href = ' ++ destinationURL ++ "'")


Which you can add to any element like this:

    button 
      [ class "mdl-button", redirectTo "https://google.com"; ]
      [ text "Click to leave" ]

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to