void OnActionAdded(FormsWebView sender, string key, bool isGlobal) { if (isGlobal || (Element != null && Element.Equals(sender))) { InjectJavascript(WebViewControlDelegate.GenerateFunctionScript(key)); } }
void OnActionAdded(FormsWebView sender, string key, bool isGlobal) { if (isGlobal || sender.Equals(Element)) { InjectJS(WebViewControlDelegate.GenerateFunctionScript(key)); } }
async void OnActionAdded(FormsWebView sender, string key, bool isGlobal) { if (isGlobal || Element.Equals(sender)) { await Control.InvokeScriptAsync("eval", new[] { WebViewControlDelegate.GenerateFunctionScript(key) }); } }
private async void OnActionAdded(FormsWebView sender, string key) { if (Element == sender && Control != null) { await Control.InvokeScriptAsync("eval", new[] { WebViewControlDelegate.GenerateFunctionScript(key) }); } }
public void GoForward() { if (CanGoForward) { WebViewControlDelegate.NavigateThroughStack(this, true); } }
public void GoBack() { if (CanGoBack) { WebViewControlDelegate.NavigateThroughStack(this, false); } }
public static void RegisterGlobalCallback(string name, Action <string> callback) { if (GlobalRegisteredActions.ContainsKey(name)) { return; } GlobalRegisteredActions.Add(name, callback); WebViewControlDelegate.NotifyCallbacksChanged(null, name, true); }
public void RegisterLocalCallback(string name, Action <string> callback) { if (LocalRegisteredActions.ContainsKey(name)) { return; } LocalRegisteredActions.Add(name, callback); WebViewControlDelegate.NotifyCallbacksChanged(this, name, false); }
public override void DidFinishNavigation(WKWebView webView, WKNavigation navigation) { Renderer.InjectJS(WebViewControlDelegate.InjectedFunction); foreach (var key in Element.GetAllCallbacks()) { Renderer.InjectJS(WebViewControlDelegate.GenerateFunctionScript(key)); } Element.InvokeEvent(WebViewEventType.ContentLoaded, new ContentLoadedDelegate(Element, webView.Url.AbsoluteUrl.ToString())); }
public override void OnPageFinished(Android.Webkit.WebView view, string url) { Renderer.InjectJS(WebViewControlDelegate.InjectedFunction); foreach (var key in Element.GetAllCallbacks()) { Renderer.InjectJS(WebViewControlDelegate.GenerateFunctionScript(key)); } Element.InvokeEvent(WebViewEventType.ContentLoaded, new ContentLoadedDelegate(Element, url)); base.OnPageFinished(view, url); }
private async void OnContentLoaded(Windows.UI.Xaml.Controls.WebView sender, Windows.UI.Xaml.Controls.WebViewDOMContentLoadedEventArgs args) { await Control.InvokeScriptAsync("eval", new[] { WebViewControlDelegate.InjectedFunction }); foreach (var key in Element.GetAllCallbacks()) { await Control.InvokeScriptAsync("eval", new[] { WebViewControlDelegate.GenerateFunctionScript(key) }); } Element.InvokeEvent(WebViewEventType.ContentLoaded, new ContentLoadedDelegate(Element, args.Uri != null ? args.Uri.AbsoluteUri : "")); }
public override void OnPageFinished(Android.Webkit.WebView view, string url) { Renderer.InjectJS(WebViewControlDelegate.InjectedFunction); foreach (var key in Element.GetAllCallbacks()) { Renderer.InjectJS(WebViewControlDelegate.GenerateFunctionScript(key)); } Element.SetValue(FormsWebView.UriProperty, url); Element.InvokeEvent(WebViewEventType.NavigationComplete, new NavigationCompletedDelegate(Element, url, true)); base.OnPageFinished(view, url); }
public override void DidFinishNavigation(WKWebView webView, WKNavigation navigation) { Renderer.InjectJS(WebViewControlDelegate.InjectedFunction); foreach (var key in Element.GetAllCallbacks()) { Renderer.InjectJS(WebViewControlDelegate.GenerateFunctionScript(key)); } if (webView.Url.AbsoluteUrl != null) { Element.SetValue(FormsWebView.UriProperty, webView.Url.AbsoluteUrl.ToString()); } Element.InvokeEvent(WebViewEventType.NavigationComplete, new NavigationCompletedDelegate(Element, webView.Url.AbsoluteUrl.ToString(), true)); }
private async void OnNavigated(Windows.UI.Xaml.Controls.WebView sender, Windows.UI.Xaml.Controls.WebViewNavigationCompletedEventArgs args) { await Control.InvokeScriptAsync("eval", new[] { WebViewControlDelegate.InjectedFunction }); foreach (var key in Element.GetAllCallbacks()) { await Control.InvokeScriptAsync("eval", new[] { WebViewControlDelegate.GenerateFunctionScript(key) }); } var uri = args.Uri != null ? args.Uri.AbsoluteUri : ""; Element.SetValue(FormsWebView.UriProperty, uri); Element.InvokeEvent(WebViewEventType.NavigationComplete, new NavigationCompletedDelegate(Element, uri)); }
public override void DidFinishNavigation(WKWebView webView, WKNavigation navigation) { Renderer.InjectJS(WebViewControlDelegate.InjectedFunction); foreach (var key in Element.GetLocalCallbacks()) { Renderer.InjectJS(WebViewControlDelegate.GenerateFunctionScript(key)); } foreach (var key in Element.GetGlobalCallbacks()) { Renderer.InjectJS(WebViewControlDelegate.GenerateFunctionScript(key)); } Element.InvokeEvent(WebViewEventType.NavigationStackUpdate, new NavigationStackUpdateDelegate(Element, Renderer.Control.CanGoBack, Renderer.Control.CanGoForward)); Element.InvokeEvent(WebViewEventType.ContentLoaded, new ContentLoadedDelegate(Element, webView.Url.AbsoluteUrl.ToString())); }
async void OnContentLoaded(Windows.UI.Xaml.Controls.WebView sender, Windows.UI.Xaml.Controls.WebViewDOMContentLoadedEventArgs args) { await Control.InvokeScriptAsync("eval", new[] { WebViewControlDelegate.InjectedFunction }); foreach (var key in Element.GetLocalCallbacks()) { await Control.InvokeScriptAsync("eval", new[] { WebViewControlDelegate.GenerateFunctionScript(key) }); } foreach (var key in Element.GetGlobalCallbacks()) { await Control.InvokeScriptAsync("eval", new[] { WebViewControlDelegate.GenerateFunctionScript(key) }); } Element.InvokeEvent(WebViewEventType.NavigationStackUpdate, new NavigationStackUpdateDelegate(Element, Control.CanGoBack, Control.CanGoForward)); Element.InvokeEvent(WebViewEventType.ContentLoaded, new ContentLoadedDelegate(Element, args.Uri != null ? args.Uri.AbsoluteUri : "")); }
public override void OnPageFinished(Android.Webkit.WebView view, string url) { Element.InvokeEvent(WebViewEventType.NavigationComplete, new NavigationCompletedDelegate(Element, url, true)); Renderer.InjectJS(WebViewControlDelegate.InjectedFunction); foreach (var key in Element.GetGlobalCallbacks()) { Renderer.InjectJS(WebViewControlDelegate.GenerateFunctionScript(key)); } foreach (var key in Element.GetLocalCallbacks()) { Renderer.InjectJS(WebViewControlDelegate.GenerateFunctionScript(key)); } Element.InvokeEvent(WebViewEventType.NavigationStackUpdate, new NavigationStackUpdateDelegate(Element, Renderer.Control.CanGoBack(), Renderer.Control.CanGoForward())); Element.InvokeEvent(WebViewEventType.ContentLoaded, new ContentLoadedDelegate(Element, url)); base.OnPageFinished(view, url); }
private void OnActionAdded(FormsWebView sender, string key) { InjectJS(WebViewControlDelegate.GenerateFunctionScript(key)); }
public void InjectJavascript(string js) { WebViewControlDelegate.InjectJavascript(this, js); }