Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16310] iOS: HTML JavaScript files not loading with absolute paths

GitHub Issuen/a
TypeBug
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsn/a
ReporterChris Barber
AssigneeUnknown
Created2014-01-24T23:38:03.000+0000
Updated2018-02-28T20:03:13.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.
[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.

Comments

No comments

JSON Source