Get the url from a liveview request

Hey everyone,

I want to get the lv request URL in :on_mount and I’m facing some issues.

Does anyone have any ideas?

Thanks! :smiley:

1 Like

The URL is available in the handle_params callback that is invoked after mount: Phoenix.LiveView — Phoenix LiveView v0.17.9

6 Likes

Thanks a lot.

1 Like

Using on_mount, you can attach_hook to the handle_params lifecycle callback and do your url handling there

4 Likes