PhoneGap Relative URL

后端 未结 3 1214
花落未央
花落未央 2021-01-13 04:16

I\'ve build a mobile site using jQTouch, and now I\'ve been working to get that same site working with PhoneGap. For PhoneGap, I\'ve moved most all of the assets (pages, im

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-13 05:10

    When using PhoneGap the main files will be on the phone so relative files will be relative to the location on the phone.

    If you need to access a file on a remote server (your mobile site) then it must be specified absolutely.

    If your main HTML page within your PhoneGap app is at file://www/index.html and you try and access a relative file (say "logo.png") and so specify you're really getting it from file://www/logo.png.

    If you actually wanted the version of logo.png which is actually on your remote website, you have to provide the full (absolute) path or there's no way for the browser to know that when you specify "logo.png" you mean the one at "http://www.your-site.com/logo.png".

提交回复
热议问题