1

I'm using links with relative paths within my phonegap application. I've been testing on both iOS and Android.

On android links such as '/about' will attempt to load from 'file:///about' rather than the correct relative URL.

On initial load, $('base').attr('href') returns the full and proper domain of the website.

I can't tell if this is changing, or why, for the app crashes upon error.

This has happened before! Although I normally have not experienced this issue with iOS, it did appear once. After using the camera to capture a photo, the base path is changed by some internal combination of phonegap and jqm, and must be changed back.

Is this a phonegap issue? Or something from jquery mobile?

Thanks! This is being quite an elusive bug.

Peter Ehrlich
  • 6,969
  • 4
  • 49
  • 65

2 Answers2

0

in your example you mentioned /about not working on android, but this is not a relative url "about" without the slash is one.

so /about leading to file:///about is correct behaviour. Can you try a real relative url instead?

Daniel Kurka
  • 7,973
  • 2
  • 24
  • 43
  • Just ran a test. I set the data-url attribute to the full path, including protocol and domain, and tested two buttons, one to /send_feedback and one to simply send_feedback. The error has now changed, and is the same in both cases: "./sendfeedback was not found" – Peter Ehrlich Jan 11 '12 at 08:04
-1

Adding a data-url attribute to the pages seemed to do the trick

Peter Ehrlich
  • 6,969
  • 4
  • 49
  • 65
  • could you elaborate? data-url=? and where? html, head, meta ? – tribalvibes Jan 31 '12 at 09:30
  • 1
    I had it set on every page to the page's web path. But I think that was a false positive. Here's the real issue: http://stackoverflow.com/questions/8899608/what-is-the-state-of-whitelisting-in-phonegap-1-3-0/8899637#8899637 http://stackoverflow.com/questions/5911255/phonegap-for-iphone-problem-loading-external-url – Peter Ehrlich Jan 31 '12 at 15:48