我正在尝试使用IE7-JS库使浏览器少于IE9认为它们是IE9。图书馆在这里托管:

http://code.google.com/p/ie7-js/

我将其引用如我的主页:

<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->

由于我介绍了此文件,因此我的结构图控制器工厂 - 在此处定义:

public class StructureMapControllerFactory : DefaultControllerFactory
{
    protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType)
    {
        try
        {
            if (controllerType == null) return base.GetControllerInstance(requestContext, controllerType);
            return ObjectFactory.GetInstance(controllerType) as IController;
        }
        catch (System.Exception xpt)
        {
            // The controller for path '/WSOD-layout-page.css' was not found or does not implement IController.
            // The controller for path '/layout-header.css' was not found or does not implement IController.
            // The controller for path '/layout-content.css' was not found or does not implement IController.
            // The controller for path '/component-leaderboard.css' was not found or does not implement IController.
            // etc...

        }
    }
}

正在捕获以下错误:

System.Web.HttpException: The controller for path '/component-page-title.css' was not found or does not implement IController.

但这不仅仅是这个 - 我引用的每个CSS文件都会收到类似的错误。为什么会这样?

为了澄清,这些CSS文件托管在与我正在处理的域不同的域上。这是问题吗?

为什么CSS请求将路由到我的应用程序?我想知道这是否可以阻止/可以解决?

更新:

我将其作为开发人员的错误。错误报告在这里: http://code.google.com/p/ie7-js/issues/detail?id=284

有帮助吗?

解决方案

好吧,IE7-JS脚本文件正在尝试从服务器中检索这些文件,以对它们进行一些工作。

在这里查看脚本(是的,我知道这不是IE9,但这是我看到的第一个未压缩):

http://code.google.com/p/ie7-js/source/browse/version/2.0(Beta)/src/ie8.js

您可以看到它正在尝试加载这些CSS文件(行1170ish)。我认为该系统正在将这些CSS文件请求视为拦截的动作,并且正在轰炸它,因为它无法理解它,这就是为什么它在控制器上轰炸的原因。

我不确定为什么ASP.NET MVC将它们视为动作(GET/POST)。但我希望这会有所帮助。

其他提示

为了澄清,这些CSS文件托管在与我正在处理的域不同的域上。这是问题吗?

正如瑞安(Ryan)提到的1170ish上的代码正在尝试确定CSS文件的路径。无论出于何种原因,它都假设它们在同一域上,因此我认为这是IE9.js的错误/功能。最终,这两种方法被调用,这些方法似乎从路径上截断了域:

var RELATIVE = /^[\w\.]+[^:]*$/;
function makePath(href, path) {
  if (RELATIVE.test(href)) href = (path || "") + href;
  return href;
};

function getPath(href, path) {
  href = makePath(href, path);
  return href.slice(0, href.lastIndexOf("/") + 1);
};
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top