jeudi 9 novembre 2017

Disabling browser back button globally

I am keeping my own back button on the application. since I don't want to enable the browsers back button. ( client requires ). to do this I implemented this code a page:

init(){

        history.pushState(null, null, document.URL);
        Ember.$(window).on('popstate', function () {
            history.pushState(null, null, document.URL);
        });

    },

it works fine. no issues. But I do have 2 constrain here:

  1. I don't want to write the same code to call my application pages. i have number of pages.

  2. init will call only one on controller loads. so, user can go forward and backwards after init action expires.

So simply how to handle this scenario?




Aucun commentaire:

Enregistrer un commentaire