windows phone 8.1中webview (Xaml/ c#)脚本无法加载

本文关键字:脚本 加载 Xaml phone webview windows | 更新日期: 2023-09-27 18:05:40

这是我在Windows store应用程序和Windows phone应用程序中用于将html嵌入webview的代码。它在windows商店应用程序中工作,但在手机应用程序中不工作。

<WebView x:Name="game" Source="ms-appx-web:///Folder/index.html" Grid.Row="0" Loaded="webview_loaded"/>

这是index.html

中的html代码
<html>
<head>
<link rel="stylesheet" href="style.css"/>
</head>
<body>
<canvas id="canvas"></canvas>
<script src="script.js"></script>
</body>
</html>

通过来回我发现script.js是加载在windows手机应用程序。有什么方法来解决这个问题?提前感谢!

windows phone 8.1中webview (Xaml/ c#)脚本无法加载

Windows Phone浏览器默认禁用Javascript。试着在浏览器上设置IsScriptEnabled="true"

确保解决方案资源管理器中文件的Build Action属性设置为Content。