Cordova BackButton ne fonctionne pas du premier lancement de temps

 I have a problem that Cordova event on the Back button does not do anything yet to execute alert ()  
 Below I paste my code that what I have tried kindly let me know what was the mistake I made

  <!DOCTYPE html>
<html lang=en>
<meta charset=utf-8>
<meta name=viewport content=width=device-width, initial-scale=1>
<link rel=stylesheet href=css/bootstrap.min.css>
<link rel=stylesheet href=css/style.css>
<link rel=stylesheet href=css/media.css>
<link rel=stylesheet href=css/font-awesome.css>
<link rel=stylesheet type=text/css href=css/material-design-iconic-font.min.css>
<link rel=stylesheet type=text/css href=./css/snackbar.min.css title=blue media=screen />

<script src=./js/snackbar.min.js type=text/javascript>
<script src=js/jquery.min.js></script>
<script src=js/popper.min.js></script>
<script src=js/bootstrap.min.js></script>

<!-- onload=onLoad(); -->
<body  class=color-green-bg>

<div class=overview-login>
    <div class=login-header>

            <nav class=navbar navbar-expand-lg navbar-dark bg-transparent>
                    <a class=navbar-brand mr-auto href=# onclick=Exit();><i class=fa fa-arrow-left aria-hidden=true></i></a>

        <div class=login_logo><img src=images/logo.png alt=logo
                title=logo /></div>
        <div class=Logo><img src=images/.png alt=logo title=logo />

        <a href=./Login/pin_view.html>
            <div class=mediaCard>
                <div class=mediaCardLogoIcon>
                    <img src=images/poll.png alt=>
                <div class=mediaCardTitle>
                    <h1>Mind Poll<br><small>Survey & Feedback</small></h1>
        <a href=./Home/media_list.html>
           <div class=mediaCard media>
                <div class=mediaCardLogoIcon>
                    <img src=images/media.png alt=>
                <div class=mediaCardTitle>
                    <h1>News<br><small>via Media</small></h1>



<script type=text/javascript src=cordova.js></script>
<script type=text/javascript src=js/Toast.js></script>
<!-- <script src=select_mindpool_media.js></script> -->
 <script src=./Util/conts.js></script>
<script src=./Util/network_status.js></script>
 <script type=text/javascript src=./Util/push_notification.js></script>

<script  type=text/javascript >

$( document ).ready(function() {
//Here is your Code   
document.addEventListener(deviceready, onDeviceReady, false);
function onDeviceReady() {
          document.addEventListener(backbutton, onBackKeyDown, false);


 function onBackKeyDown() {
alert('test backbutton clicked');  
Exit() ;

function Exit() {
    //Create Confirm Function
    var message = Are you sure want to Exit CrewApp ?;
    var title = Exit;
    var buttonLabels = YES,NO;
    navigator.notification.confirm(message, confirmCallback, title, buttonLabels);

    function confirmCallback(buttonIndex) {
        if (buttonIndex == 1) {
        } else if (buttonIndex == 2) {

        console.log(You clicked  + buttonIndex +  button!);
Créé 09/10/2019 à 12:59
source utilisateur
Dans d'autres langues...                            

Cookies help us deliver our services. By using our services, you agree to our use of cookies. Learn more