最近用VS2022的MAUI开发一个安卓应用,一切都很顺利,但在操作WebView的控件上,发现C#并不能执行WebView控件嵌套html页面里面js的print()打印功能,查了下,好象安卓本身也不支持,需要改写 WebView控件的 ShouldOverrideUrlLoading方法,俱体这样 假设你的webView控件命名为:webView那么,第一步,新建一个类,这个类必须放在安卓专有的目录下:我是放在 项目\Platforms\Android\CustomWebViewClient.cs CustomWebViewClient.cs源码如下: using Android.Content; using Android.Print; using Android.Webkit; using Java.Net; using Microsoft.Maui.Platform; using Newtonsoft.Json; using System.Net; namespace myapp { public class CustomWebViewClient :...
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Get in touch with using
Contact using, search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck Rack