Dan
Dan

Reputation: 1

How to use WKWebView with local file in appcelerator Titanium?

I tried to use the new WKWebview with a local URL for appcelerator

var WK = require('ti.wkwebview');

var webview = WK.createWebView({
    url:'about.html',
});

win.add(webview);

My about.html file is in the root folder, and the HTML code is :

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test Page</title>
</head>

<body style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:14px">
<p align="center"><img src="images/DefaultIcon.png" alt="" width="50" height="50" border="0"></p>
<p align="center"><b>Text to test thanks</p>
<br/>
</html>

But the page does not displayed. I don't understand why. Any idea ?

Upvotes: 0

Views: 396

Answers (1)

Newport99
Newport99

Reputation: 483

The path used by the url property when referring to local web content is relative to your project's Resources directory for Titanium projects, or app/assets and app/lib directories for Alloy project.

Using Local Web Content with WebView

Upvotes: 1

Related Questions