Helpers for history
interaction as part of an Interface
urlRequest : Web.Interface AppUrl
An Interface
for getting the current page's app-specific URL.
Is usually used while starting up the app.
Note: Uses window.location.href
pushUrl : AppUrl -> Web.Interface future_
An Interface
for changing the app-specific URL
and adding a new entry to the browser history
without triggering a page load.
Replacement for Browser.Navigation.pushUrl
replaceUrl : AppUrl -> Web.Interface future_
An Interface
for changing the app-specific URL,
without triggering a page load or adding a new entry to the browser history.
This can be useful if you have search box and you want the ?search=hats in the URL to match without adding a history entry for every single key stroke. Imagine how annoying it would be to click back thirty times and still be on the same page!
Replacement for Browser.Navigation.replaceUrl
moveForward : Basics.Int -> Web.Interface future_
An Interface
for going forward a given number of pages.
If there are no more pages in the future, this will do nothing.
Note: You only manage the browser history that you created.
Replacement for Browser.Navigation.forward
moveBack : Basics.Int -> Web.Interface future_
An Interface
for going back a given number of pages.
Note: You only manage the browser history that you created.
Replacement for Browser.Navigation.back
movementListen : Web.Interface AppUrl
If you used pushUrl
to update the URL with new history entries,
when the user clicks ← or → buttons (or you call moveForward
or moveBack
yourself),
the URL will change but your UI will not.
movementListen
is an Interface
for detecting those URL changes and making ui changes as needed.
When the app itself initiates a url change with pushUrl
or replaceUrl
, no such event is triggered.
Note: This event is called "popstate" in js
load : String -> Web.Interface future_
An Interface
for leaving the current page and loading the given URL.
This always results in a page load, even if the provided URL is the same as the current one.
gotoElmWebsite : Web.Interface future_
gotoElmWebsite =
Web.Navigation.load "https://elm-lang.org/"
Replacement for Browser.Navigation.load
reload : Web.Interface future_
An Interface
for reloading the current page.
This always results in a page load!
Note: This may grab resources from the browser cache.
Replacement for Browser.Navigation.reload