Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-330] android: dynamically update local urls fail with "absolute" paths

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionCannot Reproduce
Resolution Date2012-05-09T10:08:04.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelsn/a
ReporterDaniel Sternbergh
AssigneeNeeraj Gupta
Created2011-04-15T02:27:22.000+0000
Updated2017-03-10T18:21:37.000+0000

Description

A reference to a local file, for example <img src="/images/pic0.png"> will correctly load the file pic0.png from the .../Releases/images directory if set in the HTML at first page load, but if the location is changed dynamically in JS, the file will not be found and will fail to load. A relative path (<img src="images/pic0.png") will succeed if the images directory is in the same parent directory as the HTML page referencing it.

Comments

  1. dukz 2011-04-15

    Any timeline on this?

    Was looking for the problem and found out 2 hours later. :(

  2. Dawson Toth 2012-05-09

       var win = Ti.UI.createWindow({
           backgroundColor: '#fff'
       });
       
       /*
        These images can be downloaded from:
        - http://appc.me/content/bug.png
        - http://appc.me/content/kitten.jpg
        */
       var images = [ '/images/bug.png', 'images/kitten.jpg' ];
       var imageIndex = 0;
       var image = Ti.UI.createImageView({
           image: images[0],
           bottom: 50
       });
       win.add(image);
       
       var changeImage = Ti.UI.createButton({
           title: 'Change Image',
           bottom: 0,
           height: 50
       });
       changeImage.addEventListener('click', function (evt) {
           image.image = images[++imageIndex % images.length];
       });
       win.add(changeImage);
       
       win.open();
       
  3. Lee Morris 2017-03-10

    Closing ticket as the issue cannot be reproduced.

JSON Source