本地javascript在Flutter Webview中不起作用

问题描述 投票:0回答:1

下面是我的html和Java脚本页面,并且html没有使用js源

内容简介

WebView(
         javascriptMode: JavascriptMode.unrestricted,
         initialUrl: "html/index.html",

            )

index.html

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>HTML</title>
 </head>

<body>

    <script src="js/main.js"></script>
    <h2>Hi</h2>
    <script>
        alert('html')
    </script>
</body>

</html>

main.js

alert("inside js");

正在显示警报html,但警报inside js无效

已经尝试颤振webViewWebviewScaffold

javascript html flutter flutter-layout
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.