如何在 cefsharp 中授予地理定位权限
我最近创建了基于 cefsharp 的项目,我想授予站点地理定位权限,但不知道为什么我的代码不起作用。我收到这个错误:
CefSharp.DevTools.DevToolsClientException:'DevTools 客户端错误 :不支持浏览器上下文管理。' .
我在这个主题上没有找到任何东西。
代码:
public async void init(){
await webBrowser.WaitForInitialLoadAsync();
using (var devToolsClient = webBrowser.GetDevToolsClient())
{
CefSharp.DevTools.Browser.PermissionDescriptor perm = new CefSharp.DevTools.Browser.PermissionDescriptor();
perm.Name = "geolocation";
await devToolsClient.Browser.SetPermissionAsync(perm, CefSharp.DevTools.Browser.PermissionSetting.Granted ,"https://www.test.com/") ;
}
}
I have recently created project based on cefsharp and I want to give permission for geolocation to a site, but idk why my code doesn't work. I got this error :
CefSharp.DevTools.DevToolsClientException : 'DevTools Client Error
:Browser context management is not supported.' .
I have don't find anything at this subject.
The code :
public async void init(){
await webBrowser.WaitForInitialLoadAsync();
using (var devToolsClient = webBrowser.GetDevToolsClient())
{
CefSharp.DevTools.Browser.PermissionDescriptor perm = new CefSharp.DevTools.Browser.PermissionDescriptor();
perm.Name = "geolocation";
await devToolsClient.Browser.SetPermissionAsync(perm, CefSharp.DevTools.Browser.PermissionSetting.Granted ,"https://www.test.com/") ;
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论