← Events and errors

Restore History and opened URLs

app.handle · app.resolve · exact host payloads
history token · admitted URL

Browser History carries only an app-authored state token, while open_url carries an admitted browser fragment or native application URL.

When to use it

Use the History recipe for the complete checked implementation; this card explains the two distinct incoming boundaries.

  • history target is app and value is the bounded token previously written by this project.
  • open_url target is browser for admitted web fragment changes and app for admitted native URL opens.
  • Parse and validate the URL into a compiled route; do not concatenate its fragments into application state.
  • On failure, keep the current route and show a recoverable status if the user needs feedback.

Focused example

if action == "history" and target == "app" then
    if not router.restoreEncoded(value).success then
        message = "Ignored invalid history state"
    end
elseif action == "open_url" and (target == "browser" or target == "app") then
    local matched = routes.match(extractLocation(value))
    if matched.success and matched.entry ~= nil then
        router.replace(matched.entry)
    else
        message = "Ignored unsupported link"
    end
end

Complete inventory

View all pages in Events and errors
← Previous: Decode a system Back intentNext: Decode live media state →