I am trying to get location permission in electron, and i have tried using the ("setPermisionRequestHandler" in session) but it seems not to be working, what am i doing wrong? here is it:
session
.fromPartition("some-partition")
.setPermissionRequestHandler((webContents, permission, callback) => {
const url = webContents.getURL();
if (permission === "geolocation") {
// Approves the permissions request
callback(true);
}
// Verify URL
if (!url.startsWith("https://puram.com")) {
// Denies the permissions request
return callback(false);
}
});