-
Notifications
You must be signed in to change notification settings - Fork 107
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
Reloading the session #1051
Comments
I looked around some more, and doing this solves my problem:
This is because linking to the page using a href causes the browser to discard the current page after clicking it, preventing the routing from keeping the JavaScript state. Does anyone know of a nicer way to do this? Ideally, using the Obelisk routing facilities. Maybe you can specify that the page should be entirely reloaded after routing somehow? |
Unfortunately, using href doesn't work on Android, so I need to find another solution. Href works for html files in the static directory, but not for routes. I get the error:
When I try to click that link. |
This restriction also seems to apply to ID href links. That is, href links like this: |
I solved it in an ugly way using JavaScript by putting this in my head:
and this inside my routing function, so that it's called whenever the page is re-routed.
The inlineJs is simply a wrapper like this:
|
One Android compilation later, and it turns out I declared victory too soon, reloading it using I'm out of ideas, it looks like I will just have to write some Javascript to clean up after the bad Javascript I'm loading. |
Hello!
I handle the user clicking links by using the routing feature, however, on some pages I need to load in unstable Javascript that needs to be unloaded after the person leaves the page.
The way I dealt with it in the past was to simply link it as an HTML page, so as the user exited the page, the entire DOM and Javascript session would be reloaded. But now that I have converted it into Haskell, I link to it using an Obelisk route, and it doesn't flush the Javascript session between links.
How would I go about clearing the Javascript session to get rid of any bad code that I loaded in?
Thank you!
The text was updated successfully, but these errors were encountered: