Vaduganathan created CB-955:
-------------------------------
Summary: CordovaWebViewClient shouldOverrideUrlLoading method not
called upon a redirect
Key: CB-955
URL: https://issues.apache.org/jira/browse/CB-955
Project: Apache Cordova
Issue Type: Bug
Components: Android
Affects Versions: 1.8.1
Environment: - Android 4.0 emulator running in windows machine as well
in iOS machine
- Android 2.3 device.
Reporter: Vaduganathan
Assignee: Joe Bowser
Summary
-------
in Cordova v 1.8.1 a DroidGap.appview's
CordovaWebViewClient.shouldOverrideUrlLoading method is not called when that
appview loads a URL that results in a redirect.
To reproduce
------------
- create a DroidGap activity and set instance of CordovaWebViewClient as
DroidGap.appview's WebViewClient.
- override shouldOverrideUrlLoading
- have the DroidGap.appview load a URL that redirects to another page
Sample code (from within an Activity subclass):
public class HelloPhoneGapActivity extends DroidGap {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
try{
super.onCreate(savedInstanceState);
super.init();
super.appView.clearCache(true);
super.appView.clearHistory();
this.appView.setWebViewClient(new CordovaWebViewClient(this){
public boolean shouldOverrideUrlLoading(final WebView view, String url)
{
Log.i("BugTest", "shouldOverrideUrlLoading: " + url);
return true;
}
public void onPageStarted(WebView view, String url, Bitmap favicon) {
Log.i("BugTest", "onPageStarted: " + url);
}
public void onPageFinished(WebView view, String url) {
Log.i("BugTest", "onPageFinished: " + url);
}
});
super.loadUrl(("http://google.com");
Actual behavior
---------------
The following is logged:
INFO/BugTest(14658): onPageStarted: http://google.com/
INFO/BugTest(14658): onPageStarted: http://www.google.com/
INFO/BugTest(14658): onPageFinished: http://www.google.com/
Expected Behavior
-----------------
On devices running with cordova 1.8.1 (Android OS version 4.0), the following
is logged:
INFO/BugTest(11447): onPageStarted: http://google.com/
INFO/BugTest(11447): onPageStarted: http://www.google.com/
INFO/BugTest(11447): shouldOverrideUrlLoading: http://www.google.com/
INFO/BugTest(11447): onPageFinished: http://www.google.com/
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira