Check username every time on page init

$$(document).on('page:init', function (e) {
  if (auth.username == null) {
      url: './pages/login.html',
      ignoreCache: true
//    alert(auth.u_id);

It work at the 1st load only but I would like to make it check every time then redirect to login page.

Use page before in event

Page Element

Event will be triggered when everything initialized and page is ready to be transitioned into view (into active/current position)

What is it, v1? In v1 it is not really possible. In v5 there is a async routes or route’s beforeEnter hook designed for this