【问题标题】:How to remove confirm navigation pop-up in mobile app如何删除移动应用中的确认导航弹出窗口
【发布时间】:2017-08-16 09:58:50
【问题描述】:

当进行更改并重定向到其他页面时会发生这种情况,尤其是在登录或注销期间。 ondevice ready 的代码是,

      document.addEventListener("deviceready", onDeviceReady, false);

function onDeviceReady() {
    //alert("ready");
    navigator.splashscreen.hide();
   window.onbeforeunload = null;
}

请提出一种隐藏此原生弹出窗口的方法..

【问题讨论】:

  • 我猜它是在您的脚本中编写的自定义逻辑。要禁用此功能,请添加 window.onbeforeunload = null;在你的脚本中
  • 请在描述中查看我的脚本,我已经添加了 window.onbeforeunload = null; @甘地
  • window.onbeforeunload = null;不必在设备就绪事件侦听器内。你的设备就绪监听器被调用了吗?
  • @Gandhi 我添加了 window.onbeforeunload = null;在 onBackKeyDown 函数内部,现在它没有显示。谢谢..
  • 发布了答案。请接受。干杯

标签: android jquery angularjs cordova mobile-application


【解决方案1】:

在您的代码中添加以下行,

window.onbeforeunload = null;

这一行不需要放在 deviceready 事件监听器中。它可以放置在单击后退按钮或页面重新加载期间调用的函数上。

【讨论】:

    猜你喜欢
    • 2014-02-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多