问题描述:

We have an angular.js application running in HTML 5 mode, and IE9 falls back to hashbang mode as expected when navigating through the app. However, if we share/post links to pages on our site, we need those links to be valid in IE9 when they're typed or pasted into the browser. Currently this only works on certain pages.

Our Contact Us page works. If you enter /base/contact in IE9, the url automatically changes to /base/#/contact and displays perfectly. Interestingly, when the link entered is /base/contact/ it does NOT work.

Most pages do not work. For instance, /base/dataset/data-registry should change in IE9 to /base/#/dataset/data-registry but it does not. The url doesn't change, and the page is not functional.

Here are the relevant routes:

$routeProvider

.when('/dataset/:id', {

templateUrl: 'components/dataset/dataset.html',

controller: 'datasetCtrl'

})

.when('/', {

templateUrl: 'components/home/home.html',

controller: 'homeCtrl'

})

.when('/contact', {

templateUrl: 'components/contact/contact.html',

controller: 'contactCtrl'

})

.when('/article/:articleId', {

templateUrl: 'components/article/article.html',

controller: 'articleCtrl'

})

.otherwise({

redirectTo: '/'

})

And in case this is a server issue, here are my IIS rules:

<rewrite>

<rules>

<rule name="dataset" stopProcessing="true">

<match url="^fir/dataset/*" />

<action type="Rewrite" url="fir/index.html" />

</rule>

<rule name="contact" stopProcessing="true">

<match url="^fir/contact/*" />

<action type="Rewrite" url="fir/index.html" />

</rule>

<rule name="article" stopProcessing="true">

<match url="^fir/article/*" />

<action type="Rewrite" url="fir/index.html" />

</rule>

<rule name="fir" stopProcessing="true">

<match url="^$" />

<action type="Redirect" url="fir/" />

</rule>

</rules>

</rewrite>

Can anyone explain why the contact gets rewritten with a hash when pasted in IE9, but the others do not?

相关阅读:
Top