JSFiddle - React, Tailwind, and code Playground
HTML
<div data-role="page" id="p1">
<a href="#p2">goto page 2</a> and then use browser's navigation.</div>
<div data-role="page" id="p2">Page 2</div>
JavaScript
$(window).on("navigate", function (event, data) {
var direction = data.state.direction;
if ( !! direction) {
alert(direction);
}
});