aces / cbrain

CBRAIN is a flexible Ruby on Rails framework for accessing and processing of large data on high-performance computing infrastructures.
GNU General Public License v3.0
70 stars 43 forks source link

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

Open prioux opened 3 months ago

prioux commented 3 months ago

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 commented 3 months ago

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

MontrealSergiy commented 3 months ago

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 commented 2 months ago

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

MontrealSergiy commented 2 months ago

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