MicrosoftEdge / WebView2Feedback

Feedback and discussions about Microsoft Edge WebView2

Home Page:https://aka.ms/webview2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Problem/Bug]: Geolocation regression in WebView2 Canary

deanmalone opened this issue · comments

What happened?

In WebView2 Canary the geolocation.watchPosition() is no longer firing location updates. The success callback function is not being called.

Note: It is working fine in Edge Canary.

Browsing to the following webpage demonstrates the issue.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Geolocation test</title>
    <script>
    function getLocation() {
        if (navigator.geolocation) {
            console.log("Geolocation is supported.");
            navigator.geolocation.watchPosition(showPosition);
        } else {
            console.log("Geolocation is not supported.");
        }
    }

    function showPosition(position) {
        console.log("Geolocation position received:", position.coords.latitude, position.coords.longitude);
        document.getElementById("latitude").innerText = position.coords.latitude;
        document.getElementById("longitude").innerText = position.coords.latitude;
    }
    </script>
</head>
<body>
    <button type="button" onclick="getLocation()">Watch geolocation</button>
    <p>Latitude: <text id="latitude"></text></p>
    <p>Longitude: <text id="longitude"></text></p>
</body>
</html>

Importance

Important. My app's user experience is significantly compromised.

Runtime Channel

Prerelease (Edge Canary/Dev/Beta)

Runtime Version

126.0.2589.0

SDK Version

1.0.1722.45

Framework

WPF

Operating System

Windows 11

OS Version

22631.3593

Repro steps

  1. Browse to the html page given in the above description.
  2. Click "Watch geolocation"
  3. Observe the Latitude: and Longitude: fields

Expected: The Latitude and Longitude coordinates are displayed.
Actual: No coordinates are displayed. The showPosition function is never called.

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

Regression in newer Runtime

Last working version (if regression)

No response