History API 和 location.reload 无法使用时怎样运行 Backbone 的 Router?


Chrome packaged app 里对 API 做了比较强硬的限制, 导致 Backbone 无法正常使用,
是否有办法可以绕过这些限制来运行 Router, 按代码目前的触发都是通过两个 API:


 if (this._wantsHashChange && this._wantsPushState) {

    if (!this._hasPushState && !this.atRoot()) {
      this.fragment = this.getFragment(null, true);
      this.location.replace(this.root + '#' + this.fragment);

      return true;

    } else if (this._hasPushState && this.atRoot() && loc.hash) {
      this.fragment = this.getHash().replace(routeStripper, '');
      this.history.replaceState({}, document.title, this.root + this.fragment);
    }

  }
  if (!this.options.silent) return this.loadUrl();
}

backbone router history

即使如此我们也 10 years, 6 months ago

Your Answer