CB-3324 Add support for back-button inappbrowser [WP8] if there is no history -> InAppBrowser is closed
This commit is contained in:
parent
34c29dc2ec
commit
1c32236353
@ -331,6 +331,8 @@ namespace WPCordovaClassLib.Cordova.Commands
|
|||||||
bar.IsVisible = !StartHidden;
|
bar.IsVisible = !StartHidden;
|
||||||
AppBar = bar;
|
AppBar = bar;
|
||||||
|
|
||||||
|
page.BackKeyPress += page_BackKeyPress;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -338,6 +340,23 @@ namespace WPCordovaClassLib.Cordova.Commands
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void page_BackKeyPress(object sender, System.ComponentModel.CancelEventArgs e)
|
||||||
|
{
|
||||||
|
#if WP8
|
||||||
|
if (browser.CanGoBack)
|
||||||
|
{
|
||||||
|
browser.GoBack();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
e.Cancel = true;
|
||||||
|
#else
|
||||||
|
browser.InvokeScript("execScript", "history.back();");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void browser_LoadCompleted(object sender, System.Windows.Navigation.NavigationEventArgs e)
|
void browser_LoadCompleted(object sender, System.Windows.Navigation.NavigationEventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -405,8 +424,10 @@ namespace WPCordovaClassLib.Cordova.Commands
|
|||||||
grid.Children.Remove(browser);
|
grid.Children.Remove(browser);
|
||||||
}
|
}
|
||||||
page.ApplicationBar = null;
|
page.ApplicationBar = null;
|
||||||
|
page.BackKeyPress -= page_BackKeyPress;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
browser = null;
|
browser = null;
|
||||||
string message = "{\"type\":\"exit\"}";
|
string message = "{\"type\":\"exit\"}";
|
||||||
PluginResult result = new PluginResult(PluginResult.Status.OK, message);
|
PluginResult result = new PluginResult(PluginResult.Status.OK, message);
|
||||||
|
Loading…
Reference in New Issue
Block a user