Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16311] Android: HTML JavaScript files not loading with absolute paths

GitHub Issuen/a
TypeBug
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelsn/a
ReporterChris Barber
AssigneeUnknown
Created2014-01-24T23:40:10.000+0000
Updated2018-02-28T20:04:08.000+0000

Description

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.

Comments

  1. jithinpv 2014-09-26

    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

JSON Source