接管unigui手机物理返回按键
接管unigui屏蔽手机物理返回按键
如果不接管,手机一按物理返回键,会立即关闭程序。
下面是接管后,会有提示:

procedure TMainmForm.UnimFormCreate(Sender: TObject); begin UniSession.AddJS('$(document).ready(function() {' + ' if (window.history && window.history.pushState) { ' + ' $(window).on("popstate", function() { ' + ' if (confirm("确定要退出应用吗?")) {' + ' window.close();' + ' } else { ' + ' window.history.pushState("forward", null, "#");' + ' window.history.forward(1); ' + ' }' + ' });' + ' } ' + ' window.history.pushState("forward", null, "#"); ' + ' window.history.forward(1);' + '}); ' ); end;
本文来自博客园,作者:{咏南中间件},转载请注明原文链接:https://www.cnblogs.com/hnxxcxg/p/19360749

浙公网安备 33010602011771号