[UWP]如何在使用webview控件时在javascript中捕获异常 [英] [UWP]How to catch an exception in javascript when using a webview control

查看:83
本文介绍了[UWP]如何在使用webview控件时在javascript中捕获异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我到处查看了如何通过炸毁我的webview控件来捕获javascript脚本异常。 每个答案告诉他们在javascript中要修复什么,但没有任何告诉我如何拦截此异常并正确清理
。 这必须是可能的,但可能不会被msft暴露。

So I have looked all over the place to find out how I can catch a javascript script exception from blowing up my webview control.  Every answer tells them what to fix in the javascript but nothing tells me how to intercept this exception and clean up correctly.  This must be possible but maybe not exposed by msft.

推荐答案

hi

如果可以在WebView控件中运行的网页中调用JavaScript中的C#代码,那将是非常不安全的,但您可以从中调用JavaScript代码C#( https://docs.microsoft.com/en- us / uwp / api / windows.ui.xaml.controls.webview.invokescriptasync
但我担心这对你想要的东西没有帮助

it would be pretty unsecure if it would be possible to call C# code from JavaScript in a Webpage running in the WebView Control but you have the possibility to call JavaScript code from C# (https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.webview.invokescriptasync) but I afraid this does not help to achieve what you want

br

Andre

br
Andre


这篇关于[UWP]如何在使用webview控件时在javascript中捕获异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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