TiShadow icon indicating copy to clipboard operation
TiShadow copied to clipboard

Android webview for local html, local images

Open ewindso opened this issue 13 years ago • 11 comments
trafficstars

If I create a webview using a local html file (say "page.html") and within page.html I reference images locally (), it won't display / find the image. However, if I run on device (outside of TiShadow) it finds it OK.

Btw -- are you going to the CODESTRONG? Be great to say "hi" and talk about where you're going with TiShadow. I feel next to Titanium it's the best thing for mobile dev.

ewindso avatar Oct 18 '12 18:10 ewindso

Great to hear you are going, look forward to meeting you and seeing you there as well.

enminc avatar Oct 18 '12 20:10 enminc

@ewindso html files are currently not rewritten for TiShadow. If you can put together a quick sample app for me I will try an make it work. I am speaking at codestrong so I might look at it on the flight. Looking forward to seeing you there.

dbankier avatar Oct 18 '12 22:10 dbankier

Thanks man -- no worries, I'll just wait 'til I see you speak man. Have a good flight!

ewindso avatar Oct 18 '12 22:10 ewindso

I found a little bit of time to look at this. Here are the steps to make it work (sort of), if you are referencing local files (images, pictures, etc):

  • Use a relative path to asset and javascript source files and not slash leading. E.g. use images/icon.png and not /images/icon.png
  • javascript files referenced by the webview should be renamed so they don't end with .js. (You will need to do this anyway when you want to make a production build due to the Titanium's compilation process.) For example just change the extension to .jsf

I've only tested against and iOS Simulator (which works) and Android device (which doesn't).

dbankier avatar Jul 04 '13 06:07 dbankier

Thanks - the .jsf extension solved the problem I was having loading local JS files into an HTML page within a WebView.

jbeuckm avatar Jul 05 '13 17:07 jbeuckm

excuse me.. I tried .jsf extension solution, but can't solve the problem on android TiShadow.. my PC's OS is windows 7( so now android only) device install works right on .js and .jsf extention. please tell me specific advice.

for example my test source directory. testapp

index.html >>> testapp2

map.jsf >>> testapp3

do I have a misunderstanding??

segamail avatar Aug 01 '13 09:08 segamail

@segamail you would need to change the script tag to point to the file, but I don't think it works on Android anyway. I think there is an issue with relative paths (to ApplicationDataDirectory) in the Ti SDK. I will need to look into (eventually).

dbankier avatar Aug 01 '13 10:08 dbankier

thanks reply. humm.. i also will try other ways.

segamail avatar Aug 01 '13 12:08 segamail

Is there any new about this issue?

yomybaby avatar Mar 21 '14 12:03 yomybaby

sorry @yomybaby, haven't looked at it any further (yet). See my comment above for iOS.

dbankier avatar Mar 27 '14 20:03 dbankier

thanks for your work @dbankier ; is there any update on the Android issue?

foolprooflabs avatar Sep 18 '14 12:09 foolprooflabs