loadUrl 可以用sdcard上的html吗?

1 view
Skip to first unread message

雷炎

unread,
Oct 30, 2012, 2:19:09 AM10/30/12
to Phone...@googlegroups.com
哪位大侠指点一下loadUrl怎么加载sdcard上的html 万分感谢

徐辉

unread,
Oct 31, 2012, 10:00:12 PM10/31/12
to Phone...@googlegroups.com
file:///android_asset/www/index.html 这样是加载phonegap里面的www文件夹
我没具体尝试,但我以为file:///www,这样的操作是访问SDCARD上的WWW目录。

在 2012年10月30日 下午2:19,雷炎 <xiaoch...@gmail.com>写道:
哪位大侠指点一下loadUrl怎么加载sdcard上的html 万分感谢

廖金舟

unread,
Nov 1, 2012, 6:16:20 AM11/1/12
to Phone...@googlegroups.com
你这个方式不行,其实file:///这种方式加载html限制太多,尤其是ajax的跨越处理,我的解决办法是自己写一个http server运行在手机上,第一次运行app时将HTML文件部署到这个http server里,然后用http://localhost:8080/index.html的方式来访问,效果很好。

xin cui

unread,
Nov 1, 2012, 6:51:35 AM11/1/12
to Phone...@googlegroups.com
httpserver 在手机上运行,首先耗资源,其次也用不到这么重量级的东西吧,参考一下原生怎么访问sdcard的

雷炎

unread,
Nov 6, 2012, 8:01:28 PM11/6/12
to Phone...@googlegroups.com
原来直接file:///mnt/sdcard/就可以,呵呵

在 2012年10月30日星期二UTC+8下午2时19分09秒,雷炎写道:
哪位大侠指点一下loadUrl怎么加载sdcard上的html 万分感谢
Reply all
Reply to author
Forward
0 new messages