1

In my single-page backbone app, I'm having trouble getting my longer urls to route properly in IE. Any urls that are nested more than one level, don't receive the proper hash fallbak when loading them directly.

top-level urls work fine...

when I load: domain.com/resource
in IE I get: domain.com/#resource (as expected)

navigating (in-app) works fine...

when I click on a link to: domain.com/resource/12345
IE sends me to: domain.com/#resource/12345 (as expected)

but accessing deeper urls directly breaks the page

when I load: domain.com/resource/12345
in IE I get: domain.com/resource/12345 !! this is incorrect, and the page doesn't load

UPDATE:

This is IE9

4

2 に答える 2

0

これを試して:

Backbone.history.start({ pushState: Modernizr.history, silent: true });
if(!Modernizr.history) {
    var rootLength = Backbone.history.options.root.length;
    var fragment = window.location.pathname.substr(rootLength);
    var search = window.location.search;
    Backbone.history.navigate('/#' + fragment + search, { trigger: true });
} else {
    Backbone.history.loadUrl(Backbone.history.getFragment())
}
于 2013-01-29T17:15:18.447 に答える
0

過去 3 時間にステージングで何か変更したかどうかはわかりませんが、私が観察している問題はこの問題に関連しています

IE は、CSS ファイルを参照するときに base 要素の相対パスをサポートしていません

ページがhttp://stage.change4cancer.org/profile/647955793をリクエストすると、ページの実際の html が取得されます。#profile/647955793 にリダイレクトする必要があるかどうかは別の問題です (コンテンツを既に読み込んでからリダイレクトする必要があるかどうかはわかりません) が、説明させてください。

http://stage.change4cancer.org/profile/647955793のその htmlには、次のタグがあります。

<base href="/" />

ただし、完全な URI がない限り、IE9 はそのタグを尊重しません。したがって、JS、CSS などへのすべてのパスが間違っています。それ以外の

http://stage.change4cancer.org/js/libs/backbone-0.9.2.min.js

それは要求している

http://stage.change4cancer.org/profile/js/libs/backbone-0.9.2.min.js

実際には、何らかの種類のさらに別の html ページを返します

外部 JS のどれもロードされていないので、もちろんうまくいかないでしょう。

于 2013-01-23T02:43:33.987 に答える