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.
[DEBUG] chromium: Unknown chromium error: -6
[INFO] I/TiWebChromeClient.console: (main) [87,87] Uncaught ReferenceError: testTest is not defined (44:file:///android_asset/Resources/lib/html/test.html)
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 emulator, device or distribution.
Note
This is NOT a CLI related bug. The CLI puts the JS file in the correct location.
Issue reproduces Titanium SDK version 3.4.0 master Titanium Studio, build: 3.3.0.201407100905 Titanium Command-Line Interface CLI version 3.3.0, Android device : Motorola Moto G, Android version : 4.4.4