为什么 ie7-js 向我的应用程序请求 CSS 文件?

发布于 2024-09-24 01:24:18 字数 1911 浏览 1 评论 0原文

我正在尝试使用 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]-->

自从我引入了这个文件以来,我的 StructureMap 控制器工厂 - 在此处定义:

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

I'm trying to use the ie7-js library to make my browsers less than ie9 think they're ie9. The library is hosted here:

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

and I'm referencing it as follows in my master page:

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

Since I've introduced this file, my StructureMap controller factory - defined here:

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...

        }
    }
}

is catching the following error:

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

but it's not just this - I'm getting a similar error for every css file I'm referencing. Why would this be the case?

To clarify, these CSS files are hosted on a different domain than the one I'm working on. Would this be the problem?

Why are CSS requests getting routed to my application? I'm wondering if this is something i can prevent/work around?

Update:

I've submitted this as a bug to the developer. The bug report is here: http://code.google.com/p/ie7-js/issues/detail?id=284

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

听,心雨的声音 2024-10-01 01:24:18

IE7-JS 脚本文件正在尝试从您的服务器检索这些文件以对其进行一些操作。

看看这里的脚本(是的,我知道这不是 Ie9,但这是我看到的第一个非压缩的):

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

您可以看到它正在尝试加载这些 CSS 文件(第 1170 行左右)。我认为系统将这些 CSS 文件请求视为拦截操作,并对其进行轰炸,因为它无法理解它,这就是它对 ControllerFactory 进行轰炸的原因。

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

Well the IE7-JS script file is trying to retrieve those files from your server to do some work on them.

looking at the scripts here (yes I know it's not Ie9, but this was the first non-compressed I saw):

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

You can see that it is trying to load these CSS files (line 1170ish). I'm thinking the System is seeing these CSS file requests as an action to intercept and is bombing on it because it can't understand it, and that's why it's bombing on the ControllerFactory.

I'm not sure why ASP.NET MVC is looking at them as an Action (GET/POST). But I hope this helps.

绮筵 2024-10-01 01:24:18

澄清一下,这些 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);
};

To clarify, these CSS files are hosted on a different domain than the one I'm working on. Would this be the problem?

As Ryan mentioned the code on 1170ish is attempting to determine the path for the CSS files. For whatever reason it's assuming they are on the same domain so I would consider it a bug/feature of IE9.js. Eventually these two methods get called which appear to truncate the domain from the path:

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);
};
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文