Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change URL without navigating to it #519

Open
ryespresso opened this issue May 16, 2023 · 2 comments
Open

Change URL without navigating to it #519

ryespresso opened this issue May 16, 2023 · 2 comments
Labels
enhancement New feature or request needs triage

Comments

@ryespresso
Copy link

Is your feature request related to a problem? Please describe.

In a project I am working on, we sometimes bring up a modal window, that we'd like to be linked to by a URL. So that if a user refreshes the screen, the modal appears.

When this modal appears, I'd like to change the URL, without navigating the user to that screen. When we close the URL, the URL will change back to where they were at.

Describe the solution you'd like

Functionality in $goto or elsewhere that allows you to change the URL without navigating away from the current page.

Describe alternatives you've considered

  • I was hoping $goto had this functionality, but I wasn't able to find a solution.
  • window.history.pushState or window.history.replaceState but it does not work
@ryespresso ryespresso added enhancement New feature or request needs triage labels May 16, 2023
@jakobrosenberg
Copy link
Member

Hi @ryeshrimp. Are you using Routify 2 or 3?

I take it that you're trying to do this, but without the modal address getting pushed to the navigation history.

@ryespresso
Copy link
Author

Using v2 @jakobrosenberg

Exactly like that, however, not getting pushed the navigation history and not actually navigating to that page.

In your example the Modal only shows in the [key].svelte file. My modal code would be in [key].svelte and the index.svelte file.

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

No branches or pull requests

2 participants