Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

$.mobile.path operations broken in Android 4.4 #6810

Closed
mnaughto opened this issue Dec 18, 2013 · 12 comments
Closed

$.mobile.path operations broken in Android 4.4 #6810

mnaughto opened this issue Dec 18, 2013 · 12 comments

Comments

@mnaughto
Copy link

Several of the operations in $.mobile.path may not perform as expected because of changes to how window.location fields are populated in the WebView of Android 4.4.

In versions < 4.4, window.location.host contains a string such as "www.myplace.com", and window.location.pathname contains something like "/admin/index.html".

However, in 4.4, this appears to change so that window.location.host is an empty string and window.location.pathname contains something like "//www.myplace.com/admin/index.html".

This discrepancy can be observed by loading http://jsbin.com/esOzuPUK/1/ in a WebView in an emulator running 4.3 and an emulator running 4.4.

This bug, at the very least, affects the output of $.mobile.path.getLocation(). However, though I'm not sure why, it also seems to be causing the bug described in #6746.

mnaughto added a commit to mnaughto/jquery-mobile that referenced this issue Dec 18, 2013
mnaughto added a commit to mnaughto/jquery-mobile that referenced this issue Dec 18, 2013
fjsj pushed a commit to vintasoftware/jquery-mobile that referenced this issue Dec 19, 2013
fjsj pushed a commit to vintasoftware/jquery-mobile that referenced this issue Dec 19, 2013
@gabrielschulhof
Copy link

I don't get it. This works just fine for me: https://www.youtube.com/watch?v=bmbmr1-h3v0 What am I doing wrong?

@gabrielschulhof
Copy link

OK, the previous video was using version 1.3.x. Here's another with version git. I still don't get what's wrong. Could it be that Google has rolled out an update that fixes the problem?

@gabrielschulhof
Copy link

@mnaughto Can you please verify that this is still a problem? We've tried to duplicate this with both emulators and actual Android 4.4 devices and the problem seems to have been fixed by Google. I'd imagine so, since it's a glaringly large error on their part.

@mrodalgaard
Copy link

I can verify that fix #7237 resolves the similar issue I was seeing with paths on Android WebView 4.4 (see http://stackoverflow.com/a/21854149/1028489 for the original issue description). Although I do not use $.mobile.path directly, I also get the empty host and leading slashes on the path.

Google's WebView 4.4 handles custom schemes and file:// different than http:// and https://. I only observe this issue when using custom schemes (might also come when using file://).

@gabrielschulhof , I do not believe Google has fixed/changed anything since the 4.4 update.

@gabrielschulhof
Copy link

OK, so this is with custom schemes. Gotcha!

@gabrielschulhof
Copy link

@mrodalgaard I'm still not seeing this problem, at least not with the Android Emulator running version 4.4.2 of Android. Maybe it only happens in 4.4.0 (for which I can't seem to be able to set up any AVDs).

@mrodalgaard
Copy link

I have not tried it on the emulator, but I am almost sure it behaves the same. I have seen the path issue on both 4.4.0 and 4.4.2 on a Nexus 7 device. It's quite a complex test setup with custom schemes. Are you trying with file://?

If I have the time, I will build a minimal Android project that can reproduce it.

@gabrielschulhof
Copy link

@mrodalgaard so, I guess the problem is present on 4.4, but not on 4.4.2. Can you please give the exact Android version number of the device/AVD where you've seen the problem?

@gabrielschulhof
Copy link

@mrodalgaard if you could create an apk that I can install to reproduce the problem, we'd be eternally grateful :)

@gabrielschulhof
Copy link

@mrodalgaard I've created a webapp with Cordova and I've run it on 4.4.2. It doesn't show the problem either with file:// or with http://.

@gabrielschulhof
Copy link

I created a plain Java app that displays a WebView and allows you to enter any URL and I also can't reproduce the problem with either http:// or file:// ...

@gabrielschulhof
Copy link

I'm going to close this issue because I cannot reproduce it, however, I'll keep the browser tab open, in case @mrodalgaard gets the time to create an app that /can/ reproduce this problem.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants