がホストする html のハイパーリンクをクリックするとWebView
、 内でページが開きますWebView
。これを許可した場合、Microsoft はアプリケーションの認定に失敗すると思います。
WebView
そのため、でナビゲーションを検出し、ブラウザで URL を起動するにはどうすればよいですか?
がホストする html のハイパーリンクをクリックするとWebView
、 内でページが開きますWebView
。これを許可した場合、Microsoft はアプリケーションの認定に失敗すると思います。
WebView
そのため、でナビゲーションを検出し、ブラウザで URL を起動するにはどうすればよいですか?
ヒントをくれたXyroidに感謝します。これは私がやったことです:
/// <summary>
/// Regex pattern for getting href links.
/// </summary>
private static readonly Regex HrefRegex = new Regex("href=\"([^\"]*)\"", RegexOptions.IgnoreCase);
// Append target="_blank" to all hrefs
html = HrefRegex.Replace(html, new MatchEvaluator(HrefReplace));
/// <summary>
/// Replaces the contents of href with href and target.
/// </summary>
/// <param name="match">The match.</param>
/// <returns>The href with target.</returns>
private static string HrefReplace(Match match)
{
return string.Format("{0} target=\"_blank\"", match.Value);
}