Skip to content
This repository has been archived by the owner on Sep 19, 2022. It is now read-only.

Deep linking #13

Closed
FeodorFitsner opened this issue Nov 6, 2020 · 1 comment
Closed

Deep linking #13

FeodorFitsner opened this issue Nov 6, 2020 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@FeodorFitsner
Copy link
Contributor

FeodorFitsner commented Nov 6, 2020

As every Pglet page is, essentially, a web app it's natural to be able to "navigate" between application parts (or states) by providing direct URL to the part.

For example, we might have two tabs in the app: "Activities" and "Settings". The current way to get into "Settings" is to open app URL http://pglet/myapp which, by default, starts with "Activities" screen and then click "Settings" tab. How do we provide a direct link to "Settings" page?

We can use URL hash to navigate (switch) between multiple application states, e.g. http://pglet/myapp#settings. Pglet provides several ways to read and change page URL hash.

hash property of page control

Reading page.hash on session start.

Writing page.hash to "push" a new virtual page into user browser's history.

hash event of page control

Whenever user clicks a link with a hash or manually changes URL a new event is fired:

  • Event target: page
  • Event name: hash
  • Event data: <url_hash>
@FeodorFitsner
Copy link
Contributor Author

Added the guide: https://pglet.io/docs/deep-linking

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant