corona中webview不能用于本地HTML文件。

local webView = native.newWebView(0, 50, 320, 430)
webView.anchorX = 0;
webView.anchorY = 0;
print("***************************************files/");
print("files/"..data[1].name..".html");
local htmlFile = "files/"..data[1].name..".html"

--Ancient Egypt
webView:request("files/"..data[1].name..".html", system.ResourceDirectory);
webView:addEventListener("urlRequest", webListener);

我在 corona 中使用时它不能打开我本地的 html 文件。有更好的 corona 使用方法吗?

点赞
用户88888888
用户88888888

webView 不支持模拟器。

在代码目录下创建“files”文件夹,并使用以下代码构建应用程序:

webView:request( "files/"..data[1].name..".html");

而不是

webView:request( "files/"..data[1].name..".html", system.ResourceDirectory );

尝试使用 data\[1\] 而不是 data\[1\].name,查看它是否返回正确的值。

2015-02-06 09:46:07