微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

用于 Flutter Webview 的 Adblocker

如何解决用于 Flutter Webview 的 Adblocker

我使用 webview_Flutter 插件制作了一个应用程序,webviews 指向一个流视频的 url。但是每次进入这个webview都会弹出一个新的广告。如果有人能提供解决方案来防止这种情况发生,我会很高兴。我在此处添加代码,并且我正在使用 NavigationDecision.prevent 来禁止广告将我带到新页面

import 'dart:io';
import 'package:Flutter/material.dart';
import 'package:webview_Flutter/webview_Flutter.dart';

class WebViewExample extends StatefulWidget {
  @override
  WebViewExampleState createState() => WebViewExampleState();
}

class WebViewExampleState extends State<WebViewExample> {
  @override
  void initState() {
    super.initState();
    if (Platform.isAndroid) WebView.platform = SurfaceAndroidWebView();
  }

  @override
  Widget build(BuildContext context) {
    return WebView(
      initialUrl: "https://streamani.net/streaming.PHP?id=MTA4NjM4&title=Boruto%3A+Naruto+Next+Generations&typesub=SUB&sub=&cover=Y292ZXIvYm9ydXRvLW5hcnV0by1uZXh0LWdlbmVyYXRpb25zLnBuZw==",javascriptMode: JavascriptMode.unrestricted,navigationDelegate: (NavigationRequest request) {
        return NavigationDecision.prevent;
      },);
  }
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。