views:

71

answers:

2

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"&gt;&lt;/script&gt;
<![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

A: 

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.

Ryan Ternier
A: 

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);
};
Todd Smith