CB-10407: Re-adding onPageStarted to re-add LOAD_START, even though it's in the wrong place
This commit is contained in:
parent
15a57485c6
commit
8da5e25eee
@ -820,6 +820,45 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* onPageStarted fires the LOAD_START_EVENT
|
||||||
|
*
|
||||||
|
* @param view
|
||||||
|
* @param url
|
||||||
|
* @param favicon
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onPageStarted(WebView view, String url, Bitmap favicon) {
|
||||||
|
super.onPageStarted(view, url, favicon);
|
||||||
|
String newloc = "";
|
||||||
|
if (url.startsWith("http:") || url.startsWith("https:") || url.startsWith("file:")) {
|
||||||
|
newloc = url;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Assume that everything is HTTP at this point, because if we don't specify,
|
||||||
|
// it really should be. Complain loudly about this!!!
|
||||||
|
LOG.e(LOG_TAG, "Possible Uncaught/Unknown URI");
|
||||||
|
newloc = "http://" + url;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update the UI if we haven't already
|
||||||
|
if (!newloc.equals(edittext.getText().toString())) {
|
||||||
|
edittext.setText(newloc);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
JSONObject obj = new JSONObject();
|
||||||
|
obj.put("type", LOAD_START_EVENT);
|
||||||
|
obj.put("url", newloc);
|
||||||
|
sendUpdate(obj, true);
|
||||||
|
} catch (JSONException ex) {
|
||||||
|
LOG.e(LOG_TAG, "URI passed in has caused a JSON error.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void onPageFinished(WebView view, String url) {
|
public void onPageFinished(WebView view, String url) {
|
||||||
super.onPageFinished(view, url);
|
super.onPageFinished(view, url);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user