[AC-6353] WebView does not handle websites that redirect to url-scheme with SDK 8
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | n/a |
Reporter | Joe Falcone |
Assignee | Shak Hossain |
Created | 2019-09-04T00:07:57.000+0000 |
Updated | 2019-11-04T18:56:57.000+0000 |
Description
This is a very particular example. We have a WebView in our app that opens are particular page on StubHub. This problem occurs with both iOS and Android.
https://www.stubhub.com/cal-bears-football-tickets/performer/140/
The StubHub website recognizes the mobile platform and, after loading the mobile web page, it does a redirect to its url-scheme as you'll see in the log of load: and beforeload: events. Prior to SDK 8, the redirect would fail transparently. With SDK 8, we get very unusual behavior. The normal mobile web page is loaded and displayed but then the stubhub:// url is loaded and we get a Webpage not available error.
Android pops up an error alert and throws the error event. iOS throws the error event.
Android Log:
[INFO] : WebViewFactory: Loading com.android.chrome version 76.0.3809.132 (code 380913237)
[WARN] : W/m.phondini.tes: ClassLoaderContext classpath element mismatch for position 0. expected=base.apk!classes2.dex, found=/data/app/com.android.chrome-zuW0BDWT7wPtSsggEOsmwg==/base.apk!classes2.dex (PCL[base.apk*3474436943:base.apk!classes2.dex*1411187084] | PCL[/data/app/com.android.chrome-zuW0BDWT7wPtSsggEOsmwg==/base.apk*3474436943:/data/app/com.android.chrome-zuW0BDWT7wPtSsggEOsmwg==/base.apk!classes2.dex*1411187084])
[INFO] : cr_LibraryLoader: Time to load native libraries: 2 ms (timestamps 5053-5055)
[INFO] : chromium: [INFO:library_loader_hooks.cc(51)] Chromium logging enabled: level = 0, default verbosity = 0
[INFO] : InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus
{color:#d04437}[INFO] : beforeload: https://www.stubhub.com/cal-bears-football-tickets/performer/140/{color}
{color:#d04437}[INFO] : I/TiWebChromeClient.console: (main) [2335,2335] [object Object] (1:https://www.stubhub.com/bfx/static/js/main.ee429248.chunk.js){color}
{color:#d04437}[INFO] : beforeload: stubhub://stubhub.com/?{color}performer_id=140&OSID=AppLinks:Performer&link_click_id=697575061536878628
{color:#d04437}[INFO] : error: stubhub://stubhub.com/?performer_id=140&OSID=AppLinks:Performer&link_click_id=697575061536878628 : net::ERR_UNKNOWN_URL_SCHEME : -10{color}
{color:#d04437}[INFO] : load: stubhub://stubhub.com/?performer_id=140&OSID=AppLinks:Performer&link_click_id=697575061536878628{color}
[ERROR] : chromium: [ERROR:web_contents_delegate.cc(203)] WebContentsDelegate::CheckMediaAccessPermission: Not supported.
[ERROR] : chromium: [ERROR:web_contents_delegate.cc(203)] WebContentsDelegate::CheckMediaAccessPermission: Not supported.
[INFO] : load: https://www.stubhub.com/cal-bears-football-tickets/performer/140/
[WARN] : chromium: [WARNING:spdy_session.cc(3317)] Received HEADERS for invalid stream 5
The iOS log is:
[INFO] : Launching iOS Simulator
[INFO] : test/1.0 (0.0.0.(null))
[INFO] : test 1.0 (Powered by Titanium 8.0.1.c4f6f25c7d)
[INFO] : beforeload: https://www.stubhub.com/cal-bears-football-tickets/performer/140/
[INFO] : beforeload: https://www.stubhub.com/cal-bears-football-tickets/performer/140/
[INFO] : beforeload: https://www.stubhub.com/cal-bears-football-tickets/performer/140/
[INFO] : beforeload: https://www.stubhub.com/cal-bears-football-tickets/performer/140/
[INFO] : beforeload: https://www.stubhub.com/cal-bears-football-tickets/performer/140/
[INFO] : beforeload: https://www.stubhub.com/cal-bears-football-tickets/performer/140/
[INFO] : beforeload: https://www.stubhub.com/cal-bears-football-tickets/performer/140/
[INFO] : beforeload: https://www.stubhub.com/cal-bears-football-tickets/performer/140/
[INFO] : beforeload: https://www.stubhub.com/cal-bears-football-tickets/performer/140/
[INFO] : beforeload: https://www.stubhub.com/cal-bears-football-tickets/performer/140/
[INFO] : beforeload: https://www.stubhub.com/cal-bears-football-tickets/performer/140/
[INFO] : beforeload: https://www.stubhub.com/cal-bears-football-tickets/performer/140/
[INFO] : beforeload: https://www.stubhub.com/cal-bears-football-tickets/performer/140/
[INFO] : beforeload: https://www.stubhub.com/cal-bears-football-tickets/performer/140/
[INFO] : beforeload: https://www.stubhub.com/cal-bears-football-tickets/performer/140/
[INFO] : beforeload: https://www.stubhub.com/cal-bears-football-tickets/performer/140/
[INFO] : beforeload: https://www.stubhub.com/cal-bears-football-tickets/performer/140/
[INFO] : beforeload: https://www.stubhub.com/cal-bears-football-tickets/performer/140/
[INFO] : beforeload: https://www.stubhub.com/cal-bears-football-tickets/performer/140/
[INFO] : beforeload: https://www.stubhub.com/cal-bears-football-tickets/performer/140/
[INFO] : beforeload: https://www.stubhub.com/cal-bears-football-tickets/performer/140/
[INFO] : beforeload: https://www.stubhub.com/cal-bears-football-tickets/performer/140/
[INFO] : beforeload: https://www.stubhub.com/cal-bears-football-tickets/performer/140/
[INFO] : beforeload: https://www.stubhub.com/cal-bears-football-tickets/performer/140/
[INFO] : beforeload: https://www.stubhub.com/cal-bears-football-tickets/performer/140/
[INFO] : beforeload: https://www.stubhub.com/cal-bears-football-tickets/performer/140/
[INFO] : beforeload: https://www.stubhub.com/cal-bears-football-tickets/performer/140/
[INFO] : beforeload: https://www.stubhub.com/cal-bears-football-tickets/performer/140/
[INFO] : beforeload: https://www.stubhub.com/cal-bears-football-tickets/performer/140/
[INFO] : beforeload: https://www.stubhub.com/cal-bears-football-tickets/performer/140/
{color:#d04437}[INFO] : error: https://www.stubhub.com/cal-bears-football-tickets/performer/140/ : unsupported URL : -1002{color}
1002 = Titanium.UI.URL_ERROR_UNSUPPORTED_SCHEME
One difference between Android and iOS is with the error event. Android gives the actual URL that caused the error while iOS gave the original URL, not the stubhub:// URL scheme.
The code is trivial
var window = Ti.UI.createWindow({
backgroundColor : 'white',
layout : 'vertical'
});
window.open();
var webview = Ti.UI.createWebView({
url : 'https://www.stubhub.com/cal-bears-football-tickets/performer/140/'
});
webview.addEventListener('load', function(e) {
var url = e.url;
Ti.API.info('load: ' + url);
});
webview.addEventListener('beforeload', function(e) {
var url = e.url;
Ti.API.info('beforeload: ' + url);
});
webview.addEventListener('error', function(e) {
var url = e.url;
Ti.API.info('error: ' + url + ' : ' + e.error + ' : ' + e.code);
});
window.add(webview);
Attachments
File | Date | Size |
---|---|---|
Screenshot_20190903-163450.jpg | 2019-09-03T23:36:46.000+0000 | 254151 |
Hello, Thanks for letting us know. Can you please test it on SDK 8.1.1.GA? To install this please open terminal and type: *appc ti sdk install 8.1.1.GA*
Same results with 8.1.1.GA and 8.3.0.v20190829124521 for both iOS and Android. This is a pretty common feature where a company has both a mobile website and a mobile application.
These websites worked fine with the 7.x SDK in case that wasn't clear. We update this particular app once a year so the last time it was built was with the version 7 SDK.
Hello [~jfalcone], I have tested your sample code with the SDK 8.1.1.GA in ios simulator, I didn't seen any error in the log, here is my log
In my view, this is worse because this means that on different platforms the webView is giving different results. I cut and pasted the log from an iPhone 7 iOS 12.4 simulator. I don't know what simulator you used but probably it was different. Were you testing on an iOS 13 simulator? The webView should give the IDENTICAL results across iOS. If it doesn't, then that should be documented. This is a very serious issue for our platform as many of our partners use url-schemes. We received the same results with 8.0.1, 8.1.1, and an 8.3 daily build.
Hello [~jfalcone], I tested with ios simulator 12.4, iPhone 7 plus. I just tested with SDK 8.2.0.GA. There is no error and the webview loads just fine. Thanks.