void OnDecidePolicyForNavigation (object sender, WebNavigationPolicyEventArgs e) { switch (e.NavigationType) { case WebNavigationType.BackForward: case WebNavigationType.FormResubmitted: case WebNavigationType.FormSubmitted: WebView.DecideIgnore (e.DecisionToken); break; case WebNavigationType.LinkClicked: NSWorkspace.SharedWorkspace.OpenUrl (e.OriginalUrl); WebView.DecideIgnore (e.DecisionToken); break; case WebNavigationType.Other: case WebNavigationType.Reload: WebView.DecideUse (e.DecisionToken); break; } }
/// <summary> /// Handles the web view decide policy for navigation. /// </summary> /// <param name='sender'> /// Sender. /// </param> /// <param name='e'> /// E. /// </param>//WebNavigationPolicyEventArgs void HandleWebViewDecidePolicyForNavigation(object sender, WebNavigationPolicyEventArgs e) { // Reference for examples of this method in use // https://github.com/mono/monomac/commit/efc6e28fc03005638ce2cd217dc6c9281ad9c1c5 var linked_note = e.Request.Url.AbsoluteString; if (linked_note != null && linked_note.StartsWith("note:", StringComparison.CurrentCulture)) { OpenNote(e.Request.Url.AbsoluteString); } if (_loadingFromString) { WebView.DecideUse(e.DecisionToken); return; } WebView.DecideIgnore(e.DecisionToken); }
void HandleDecidePolicyForNavigation(object sender, WebNavigationPolicyEventArgs e) { switch (e.OriginalUrl.Scheme) { case "ecma": WebView.DecideIgnore(e.DecisionToken); var url = e.OriginalUrl.AbsoluteString.Substring(7); CurrentObject = DocModel.ParseReference(url); return; // This is one of our rendered ecma links, we want to extract the target // from the text, not the href attribute value (since this is not easily // editable, and the text is. case "goto": url = RunJS("getText", e.OriginalUrl.Host); CurrentObject = DocModel.ParseReference(url); break; } WebView.DecideUse(e.DecisionToken); }
void HandleWebViewDecidePolicyForNavigation(object sender, WebNavigationPolicyEventArgs e) { if (LoadingFromString) { WebView.DecideUse(e.DecisionToken); return; } var mainUrl = e.Frame.WebView.MainFrameUrl; var url = e.Request.Url.AbsoluteString; // Let WebKit take care of the anchors. if (mainUrl != null && url.StartsWith(mainUrl) && url.Length > mainUrl.Length && url [mainUrl.Length] == '#') { WebView.DecideUse(e.DecisionToken); return; } WebView.DecideIgnore(e.DecisionToken); LoadUrl(url, true); }
void OnDecidePolicyForNavigation(object sender, WebNavigationPolicyEventArgs e) { switch (e.NavigationType) { case WebNavigationType.BackForward: case WebNavigationType.FormResubmitted: case WebNavigationType.FormSubmitted: WebView.DecideIgnore(e.DecisionToken); break; case WebNavigationType.LinkClicked: NSWorkspace.SharedWorkspace.OpenUrl(e.OriginalUrl); WebView.DecideIgnore(e.DecisionToken); break; case WebNavigationType.Other: case WebNavigationType.Reload: WebView.DecideUse(e.DecisionToken); break; } }
private void DecidePolicyForNavigation(object sender, WebNavigationPolicyEventArgs e) { WebView.DecideUse(e.DecisionToken); }
void HandleWebViewDecidePolicyForNavigation (object sender, WebNavigationPolicyEventArgs e) { if (LoadingFromString){ WebView.DecideUse (e.DecisionToken); return; } var mainUrl = e.Frame.WebView.MainFrameUrl; var url = e.Request.Url.AbsoluteString; // Let WebKit take care of the anchors. if (mainUrl != null && url.StartsWith (mainUrl) && url.Length > mainUrl.Length && url [mainUrl.Length] == '#'){ WebView.DecideUse (e.DecisionToken); return; } WebView.DecideIgnore (e.DecisionToken); LoadUrl (url, true); }
/// <summary> /// Handles the web view decide policy for navigation. /// </summary> /// <param name='sender'> /// Sender. /// </param> /// <param name='e'> /// E. /// </param>//WebNavigationPolicyEventArgs void HandleWebViewDecidePolicyForNavigation (object sender, WebNavigationPolicyEventArgs e) { // Reference for examples of this method in use // https://github.com/mono/monomac/commit/efc6e28fc03005638ce2cd217dc6c9281ad9c1c5 var linked_note = e.Request.Url.AbsoluteString; if (linked_note != null && linked_note.StartsWith("note:", StringComparison.CurrentCulture)) OpenNote(e.Request.Url.AbsoluteString); if (_loadingFromString){ WebView.DecideUse (e.DecisionToken); return; } WebView.DecideIgnore (e.DecisionToken); }