如何加载一个html文件,在www文件夹之外的Phonegap? [英] How to load a html file which outside of www folder in Phonegap?

查看:118
本文介绍了如何加载一个html文件,在www文件夹之外的Phonegap?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以加载位于www文件夹外的位置的html文件。



案例A :让我们考虑www文件夹包含两个文件,即
1. index.html
2. profile.html
在这里,我们可以通过锚标记 < a href =profile.html >< / a> 中找到

www文件夹包含一个文件,即
- index.html
profile.html 位于 www 文件夹之外的位置,因为我们会下载这个 profile.html 文件从服务器到我们的手机,我们假设profile.html位于我们的 SD卡
那么我们如何在case B中从index.html访问或加载profile.html?







  • $ b

    我很新鲜,我相信有人可以分享这个主题的见解。

    解决方案

    文件夹与应用程序资源一起放置,不能更改。



    一种方法是在SD卡中创建一个文件夹(我们称之为sd_www)将www文件夹的内容移动到此sd_www。而不是从www文件夹加载index.html,您将从sd_www文件夹加载index.html。



    这样,每次从文件夹下载新文件该服务器,您可以从您的index.html


    访问它

    Is it possible to load a html file which resides in location outside www folder.

    Case A: Let us consider www folder contains two files i.e. 1. index.html 2. profile.html Here we can access the profile.html by an anchor tag <a href="profile.html">Profile</a> within index.html

    Case B: Here our www folder contains one file i.e. - index.html and the profile.html resides in a location outside www folder, as we would be downloading this profile.html file from server to our phone, let us say profile.html resides on our SD Card. So how can we access or load profile.html from index.html in Case B?

    • Is this possible, accessing file outside www folder?
    • Or Is it possible to download file from server and directly place it within www folder?

    I am very new to this, and I believe somebody could share insight over this topic.

    解决方案

    The www folder is placed along with application resources and cannot be changed.

    One way to do what you want is to create a folder (let's call it sd_www) into the SD Card and move the content of your www folder to this sd_www. And instead of loading the index.html from the www folder, you'll load index.html from sd_www folder.

    This way, every time you download a new file from the server, you can access it from your index.html

    这篇关于如何加载一个html文件,在www文件夹之外的Phonegap?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆