When displaying a WebView, relative paths don't work as you'd expect if the
script is in a subdirectory. e.g.:
1. Create a folder in SL4A named test.
2. In that folder, place two files index.html and main.js.
3. In index.html, insert the line: <script src="main.js"></script>. (You might
need head and body too?)
4. In main.is, write: alert("hello")
5. Open index.html. No alert is displayed.
6. Change the include line in index.html to: <script
src="test/main.js"></script>
7. Open index.html again; the alert now appears.
This means that relative paths are based at /mnt/sdcard/sl4a/scripts, rather
than /mnt/sdcard/sl4a/scripts/test. This seems odd to me - a script's working
directory should be the one containing it, so that it can access its resources
without having to know about the directory structure above it. Otherwise the
name of the folder has to be hardcoded into every resource path, which means it
can't be moved, renamed, or copied as a base for another script without a lot
of search-and-replace.
Original issue reported on code.google.com by hyperhac...@gmail.com on 14 Jul 2012 at 8:20
Original issue reported on code.google.com by
hyperhac...@gmail.com
on 14 Jul 2012 at 8:20