jquery/jquery-mobile — Issue #3446: phonegap absolute URL
Author: pehrlich
Created: 2012-01-17 20:02:02+00:00
State: open

Hello

I'm using jqm to load from a remote resource. This works fine in a web view and with cross-domain iOS, but not cross domain Android. (The two domains being the local base page and the remote resource pages). The issue is that relative links, such as '/about' get converted to an absolute filesystem URL.

If pages have no data-url attribute, it becomes 'file:///path/to/www/about'

If pages have data-url set to the complete url, it becomes './about' (notice the . which causes 404)

I've been trying to hunt down the issue without luck (I have no Android device to test on, which makes it difficult). When pages get added to the dom, the data-url get made relative by convertUrlToDataUrl, because an isSameDomain against documentBase returns true.

When links are clicked on, they are made absoute against getClosestBaseUrl, which returns an absolute url built from the now-relative data-url attribute and documentBase.hrefNoHash

Im going to try next using a pageshow trigger to make data-url to absolute, so that when it gets passed to makeUrlAbsolute, it should not be changed, fixing the issue, hackishly.

What I don't understand is how this issue even arises. For some reason, the same documentBase that returns an hrefNoHash as ./ must also be matching an isSameDomain to 192.168.47.105:3000, which seems, to put it simply, extremely strange.