0

单击 html 托管的超链接时WebView,页面会在WebView. 我相信,如果您允许,Microsoft 将无法通过应用程序认证。

因此,我如何WebView才能检测到自身内部的导航,然后在浏览器中启动 url?

4

1 回答 1

0

感谢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);
        }
于 2013-05-28T13:37:18.017 回答