I'm having a simple html page, which registers a listener on navigate
that's there from JQuery-Mobile. But I can't see the callback getting executed.
The following is the html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
</head>
<body>
something
<script>
$( window ).on('navigate', function( event, data ){
if ( data.state.direction == "back" ) {
console.log('back button pressed');
}
if ( data.state.direction == "forward" ) {
console.log('fwd button pressed');
}
});
</script>
</body>
</html>
PS: from here I got to know that JQuery mobile don't support JQuery 3.x, so I changed it to 1.x, but still this don't help.
Whenever I press the back button (when I'm on the above html page), I suppose I should get `` on the console. But that's not happening. Is there anything obvious that I'm missing?