knooppuntnet icon indicating copy to clipboard operation
knooppuntnet copied to clipboard

Prevent map position changes to add to browser history

Open vmarc opened this issue 1 year ago • 2 comments

In the Safari browser, each time the map position is changed by zooming or panning, a new entry is added to the browser history (url query parameter change). This kind of pollutes the browser history, and can be a reason for not using this browser for knooppuntnet.

It would be useful if this could be prevented.

Chrome and Firefox do not do this (no history entries when query parameters change).

vmarc avatar Apr 10 '24 09:04 vmarc

Closing this issue as it seems nothing can be done about this.

The history behaviour is the same in openstreetmap.org, waymarkedtrails.org, google maps and OpenLayers example code.

The history in the popup window that is shown after a long press on the browser backbutton does not have the problem.

history

vmarc avatar Jun 15 '24 14:06 vmarc

Issue re-opened.

After thinking about this again, there is a simple way to prevent pan/zoom actions to fill the browser history: just do not include the position in the query parameters when they are updated.

The drawback is that a simple copy of the current url does not work anymore to share a link containing the current map position with another user.

But this could be solved by a menu option "Copy link" that could be used to copy the full url containing the position to the clipboard. For example:

image

Another option would be to have a "share" link or a copy button (similar to this one found in the GitHub project issue page) on every page :

image

vmarc avatar Jun 17 '24 07:06 vmarc