We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
internal async Task OnJavascriptInjectionRequest(string js) { if (Control == null || Element == null) return string.Empty;
var response = string.Empty; try { var script = new WKUserScript(new NSString(js), WKUserScriptInjectionTime.AtDocumentStart, false); if (!_contentController.UserScripts.Contains(script)) { _contentController.AddUserScript(script); _configuration.UserContentController = _contentController; } //var obj = await Control.EvaluateJavaScriptAsync(js).ConfigureAwait(false); //if (obj != null) // response = obj.ToString(); } catch (Exception) { /* The Webview might not be ready... */ } return response; }
代码直接写入到WKUserScriptInjectionTime.AtDocumentStart
然后在html 中,这样$(function(){ alert(jsCallAPP));} 则可以响应,如果用Control.EvaluateJavaScriptAsync(js)则在onready 事件中也未注入,所以为undefine 或报错。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
internal async Task OnJavascriptInjectionRequest(string js)
{
if (Control == null || Element == null) return string.Empty;
代码直接写入到WKUserScriptInjectionTime.AtDocumentStart
然后在html 中,这样$(function(){ alert(jsCallAPP));} 则可以响应,如果用Control.EvaluateJavaScriptAsync(js)则在onready 事件中也未注入,所以为undefine 或报错。
The text was updated successfully, but these errors were encountered: