4

我似乎发现 IE 有时会尝试使用相对 URL 加载 CSS 图像,相对于页面 url 而不是 CSS 文件 url。

示例...有人加载此网址:

https://www.main-events.com/event/234/my-awesome-show/onlineentry/step-four/do-something

那有一个CSS文件:

<link rel="stylesheet" type="text/css" href="/content/core/MainEvents.min.css" />

里面有这个:

.fade-red
{
    background: url("../../img/fade-red.png") repeat-x scroll 0 100% #9D0032;
}

然后我得到一个看起来像这样的异常:

HttpException: The controller for path '/event/234/my-awesome-show/onlineentry/img/fade-red.png' was not found or does not implement IController.

看看发生了什么?

而不是像这样加载../../img/fade-red.png相对于 CSS url 的 url ...它错误地尝试像这样相对于页面 url 加载它。/content/core/MainEvents.min.css/img/fade-red.png/event/234/my-awesome-show/onlineentry/step-four/do-something/event/234/my-awesome-show/onlineentry/img/fade-red.png

我检查了 UserAgent 字符串,它似乎总是 IE8。这是我见过的一些:

Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB5; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB7.4; .NET CLR 1.1.4322; .NET CLR 2.0.50727; WinNT-PAI 22.06.2009; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; HPNTDF; .NET4.0C; BRI/1; BRI/2)
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; OfficeLiveConnector.1.3; OfficeLivePatch.0.0; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; Trident/4.0; .NET CLR 1.1.4322; .NET4.0C)

我想我的问题是,有人遇到过这个吗?这是 IE8 的已知问题吗?将我的 css 图像网址更改为绝对唯一的解决方法吗?

4

0 回答 0