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

Strip filtering parameters from URL query within a browser after page is rendered #1386

Open
prioux opened this issue Apr 19, 2024 · 4 comments

Comments

@prioux
Copy link
Member

prioux commented Apr 19, 2024

Some links in CBRAIN send the user to a page with filters and options applied instantaneously through the use of URL query parameters; when these users move back and forth in their history, these filtering parameters take effect again, confusingly replacing whatever new filters the user has applied since then.

The solution is that whenever a page is rendered with such query params, the page should run at the end this type of javascript to edit the browser's history:

history.pushState(null, "", location.href.split("?")[0]);

We have to be careful not to do that everywhere, there are other pages where query params are OK and need to be preserved.

@prioux
Copy link
Member Author

prioux commented Apr 19, 2024

You can try the javascript code in the JS console in your browser.

@MontrealSergiy
Copy link
Contributor

MontrealSergiy commented Apr 23, 2024

Not sure I understand. Anyways, the split works as intended, executing JS command in the console seems to delete get-query from the chromes url line. Yet using the back button I can go to the old query-polluted url. On the other hand, history.replaceState({}, "", location.href.split("?")[0]); erases query entirely

@MontrealSergiy
Copy link
Contributor

MontrealSergiy commented May 3, 2024

Not sure which pages and filters and options are ok, and which should be stripped

@MontrealSergiy
Copy link
Contributor

one place for links with query params - small/large button/list project view (both NeuroHub and Cbrain). Not sure is this the one meant here, but can delete from history

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants