c# - 在 Xamarin.MAC 上使用 WebView 时出错
问题描述
当我尝试登录我的谷歌帐户时,我收到此错误。我在 Xamarin.MacOS 上使用 WebView
<controls:WebViewer x:Name="webView" Source="{Binding Url}" VerticalOptions="FillAndExpand"
Navigated="Web_OnNavigated"
Navigating="Web_OnNavigating" HorizontalOptions="FillAndExpand" />
我如何添加 WebViewer
public class WebViewer : WebView
{
public static BindableProperty GetCookiesProperty =
BindableProperty.Create(nameof(GetCookies), typeof(Func<string, CookieContainer>), typeof(CookieContainer),
null, BindingMode.OneWayToSource);
public static BindableProperty EvaluateJavascriptProperty =
BindableProperty.Create(nameof(EvaluateJavascript), typeof(Func<string, Task<string>>), typeof(WebViewer),
null, BindingMode.OneWayToSource);
public Func<string, CookieContainer> GetCookies
{
get => (Func<string, CookieContainer>) GetValue(GetCookiesProperty);
set => SetValue(GetCookiesProperty, value);
}
public Func<string, Task<string>> EvaluateJavascript
{
get => (Func<string, Task<string>>) GetValue(EvaluateJavascriptProperty);
set => SetValue(EvaluateJavascriptProperty, value);
}
}
有我对 WebViewer 的定义
这是我用来登录的网址
Url = "https://accounts.google.com/ServiceLogin/signinchooser?service=youtube&hl=en&passive=true<mpl=music&continue=https://www.youtube.com/signin?app=desktop&hl=en&feature=__FEATURE__&action_handle_signin=true&next=https%3A%2F%2Fmusic.youtube.com%2F&uilel=3&flowName=GlifWebSignIn&flowEntry=ServiceLogin";
Mb,您知道 webView 的任何更好的类似物在 MacOS 上可以使用什么?URL 是有效的。我在 Windows 上与 CefSharp 有相同的项目,它没有任何问题。我正在尝试在我的 MACOS 桌面应用程序上登录表单,但是当我尝试登录时它失败了。我没有使用 Oauth,用户是使用他的凭据登录,我得到 cookie,当我使用 youtube 的 web api 时(非官方)
解决方案
推荐阅读
- reactjs - Ref 在 React 中奇怪地变成了 null
- java - 如何将数学符号(例如 R^n)放入 Java 字符串?
- r - 如何在ggplot的散点图中根据因子列最好地绘制值列的两个子集?
- javascript - 将所选内容以 PDF 格式保存到 Google 表格电子表格
- php - 如何从 php 中的选择/选项中获取多个数据到一个变量中?
- python - 从 python 下载 xls 导致格式损坏与手动下载
- python - 当我尝试创建虚拟环境时返回非零退出状态 101 给出错误
- karate - 我如何在空手道 UI 自动化中拦截 API 调用
- python - 在线程内使用 Popen 的奇怪行为
- r - 在数据帧上应用函数,包括 rbind 语句