How to refresh a page in a backbone application

后端 未结 13 2153
北恋
北恋 2021-01-30 22:32

I am using backbone to build my web app.

Currently I am facing an issue whereby if I am on the home page, I am unable to refresh the same page by just clicking on the \'

13条回答
  •  盖世英雄少女心
    2021-01-30 22:45

    I needed to 'refresh' my page on orientation change event because not all of my css media queries for portrait mode where executed correctly by default. This is what I ended up doing:

    Backbone.history.fragment = null;
    Backbone.history.navigate(document.location.hash, true); 
    

    Of course, for the completeness of this answer, this was wrapped in some orientation change handling code:

    window.addEventListener('orientationchange', function () {
        Backbone.history.fragment = null;
        Backbone.history.navigate(document.location.hash, true); 
    }, false);
    

提交回复
热议问题