flutter 抖动设置启用JavaScript设置Web Chrome客户端

rbl8hiat  于 2023-01-02  发布在  Flutter
关注(0)|答案(1)|浏览(136)

如何启用flutter_webview_plugin 0.1.5来启用javascript并处理来自网页的javascript?这里是android的代码

mWebView = (WebView) findViewById(R.id.activity_main_webview);
    WebSettings webSettings = mWebView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    mWebView.setWebChromeClient(new WebChromeClient());
    mWebView.loadUrl("http://192.168.0.5/table.php");

如何使它在flutter中工作flutter_webview_plugin?谢谢

afdcj2ne

afdcj2ne1#

在下面的示例中,javascript模式:unrestrictMode.也在做同样的事情,启用flutter中的javascript。

MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Scaffold(
        appBar: AppBar(
          title: Text("Foxhillbazaar.com"),
        ),
        body: Center(
          child: WebView(
            initialUrl: 'https://www.foxhillbazaar.com/',
            javascriptMode: JavascriptMode.unrestricted,
            onWebViewCreated: (WebViewController webViewController) {
              _controller = webViewController;
            },
          ),
        ),
      ),
    );

相关问题