-
Notifications
You must be signed in to change notification settings - Fork 27
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
How to control Tify-related query strings in URL #24
Comments
Dear @arjanski On a second note, I keep wondering if removal of Tify query string from the URL would be an useful feature altogether. I can, for example, imagine a user re-opening/closing the modal wanting to resume viewing the same image in same zoom level etc. For this work seamlessly, the query params are vital. I hope this is of any help at all. |
I used this tifyUrlClean = () => {
let url, uri = window.location.href, regex = /([?&])tify=.*?(&|$)/;
if (uri.match(regex)) {
url = uri.replace(regex, '$2');
window.history.replaceState({}, '', url);
}
}; |
Great stuff @hrvoj3e, thanks ! Where/how did you implement it in your component? I was thinking |
Closing the Tify-containing modal won't trigger naviagtion guards or lifecycle hooks. Instead, bind the function to modal close (in your website, not in Tify ...). |
Maybe Tify could provide a way to toggle query strings in the URL. Tify setting these parameters in my app without asking or way of prevention seems somewhat intrusive to me. Imagine, every plugin I'm using does that. In the worst case, this could even be incompatible with the routing system of the app. Or even better: Tify fires an event when the user changes zoom or coordinates of the image. The app then can handle this how it wants to. |
@arjanski I used it in a non Vue project. Calling Tify in modal and cleaning after close. |
With one of the next releases, TIFY will get an option which allows to disable storing parameters in the URL. |
I've just used this:
within destroyed() hook |
With the latest release, an option |
Hello there,
is it possible to control wether/when Tify pushes its query data into the URL? The issue is that once Tify is loaded, it pushes its query string into the URL (which is generally nice to have). However, when closing a modal containing the tify div, this query then stays in the URL.
Page without tify query
http://localhost:8000/data/letter/letter_06010
Example with tify query (tify div on display)
http://localhost:8000/data/letter/letter_06010?tify={%22view%22:%22scan%22}
When tify-div is closed, the query stays
http://localhost:8000/data/letter/letter_06010?tify={%22panX%22:0.001,%22panY%22:0.001,%22view%22:%22scan%22,%22zoom%22:747.714}
Is this an error in our setup? Or is it an issue with the plugin itself?
Thank you very much for your help.
Vue version: 2.5.15
Vue Router version: 3.0.1
Tify version: 0.20.0
The text was updated successfully, but these errors were encountered: