) contains all you need, and it is supported by all modern browsers.
However, getting this to work properly in Apex took me a lot longer than I expected.
Also you don't want to update the coordinates too often, since that creates a lot of calls to the database. But you do want to update it often enough to be accurate. You need a document cookie for that, as shown below (more info here
So now I use geolocation.getCurrentPosition, setInterval, some cookies, and a package/procedure to read the cookies and set the page items. This works like a charm.
Note 3: You need to allow your browser to (always) share your location with this website.
Note 4: For sites that use authentication, on the login page you should put some code to reset the latitude/longitude document cookies.
Note 5: This feature is available only in secure contexts
(HTTPS), in some or all supporting browsers