Problem description
When loading a HTML page in a WebView that includes a JS file, the JS file is not loaded if the URL is absolute or uses the app:// protocol.
[ERROR] Error loading app://lib/html/js/test.js
Both "app://lib/html/js/test.js" and "/lib/html/js/test.js" fail.
Code to reproduce
/app.js
var win = Ti.UI.createWindow();
var web = Ti.UI.createWebView({
left: 0,
right: 0,
top: 0,
bottom: 0,
url: '/lib/html/test.html'
});
win.add(web);
win.open();
/lib/html/test.html
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<script type="application/javascript" src="app://lib/html/js/test.js"></script>
</head>
<body>
<script>testTest()</script>
</body>
</html>
/lib/html/js/test.js
function testTest() {
alert('test');
}
Steps to reproduce
Using the code above, build the app for simulator, device or distribution.
Note
This is NOT a CLI related bug. The CLI puts the JS file in the correct location.
No comments