[W8.1] Windows应用商店应用(Windows 8.1)没有互联网连接时不会触发WebView NavigationCompleted事件 [英] [W8.1]Windows Store App (windows 8.1) WebView NavigationCompleted event is not triggered when no internet connection

查看:110
本文介绍了[W8.1] Windows应用商店应用(Windows 8.1)没有互联网连接时不会触发WebView NavigationCompleted事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的Windows商店应用中,我们显示了一个html内容。我们使用了"window.external.notify"在按钮中单击该html内容并将注册的ScriptNotify事件发送到WebView。

In our windows store app, we have displayed a html content. we have used "window.external.notify" in a button click in that html content and registered ScriptNotify event to WebView.

当有互联网连接时,在加载html页面时单击该按钮时会触发ScriptNotify事件。即只有在NavigationCompleted 时才触发ScriptNotify事件。事件被触发。这个NavigationCompleted 仅当有INTERNET连接时才触发
事件。



注意:当我们在Html中使用iframe时没有互联网连接时触发NavigationCompleted

ScriptNotify event is triggered when click that button when html page is loaded when there is internet connection. i.e ScriptNotify event is triggered only when NavigationCompleted  event is triggered. This NavigationCompleted  event is triggered only when there is INTERNET connection.

NOTE: NavigationCompleted is not Triggered when no internet connection when we used iframe in Html

这可能是什么原因?谁有人建议解决方案?

What could be the reason for this? can anyone suggest a solution ?

谢谢。

推荐答案

Hello PM16,

Hello PM16,

您能否为我提供此问题的代码示例?我使用此示例测试您的此问题  当我们点击WebView内的按钮时调用ScriptNotify事件
并更改  WebView_OnScriptNotify 事件处理程序,如以下代码, NavigationCompleted事件被触发,并且在单击Button和scriptNotify后运行良好无论
有一个Interenet,都会触发事件。用网络网站测试效果也不错。请再次检查您的代码或提供示例以帮助我们查看此问题。

Could you give me the code sample for your this issue? I test your this issue using this sample Invoke ScriptNotify event when we click a button inside a WebView, and change the WebView_OnScriptNotify event handler as the following code, the NavigationCompleted event is triggered and works well after clicking the Button and the scriptNotify event is triggered whatever there is an Interenet. Also test with a network website works well. Please check your code again or provide a sample to help us see this issue.

        private void WebView_OnScriptNotify(object sender, NotifyEventArgs e)
        {
            var url = e.Value;
            WebView.Source = new Uri("ms-appx-web:///HtmlPage.html");
        }

祝你好运,

Breeze


这篇关于[W8.1] Windows应用商店应用(Windows 8.1)没有互联网连接时不会触发WebView NavigationCompleted事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆