【发布时间】:2010-07-14 08:22:18
【问题描述】:
我在框架和 Internet Explorer 方面遇到了一些非常奇怪的行为。
情况是这样的:
- 我在 www.webapp.com 上有我的网络应用程序
- 我有一个客户想要在他的网站 www.vendor.com 上创建一个登录框到我的 www.webapp.com
- 他的网站由他的网页设计师在 www.vendor.com 上设置的供应商。它由2个框架组成:
- 第一帧跨越 100% 的高度和宽度,其位置位于 www.webdedesigner.com/clients/vendor
- 第二帧跨越 0,0 并且不指向任何东西
远程站点上的登录框指向我的 Web 应用程序。并发布登录名+用户名等。 客户端的网站设置有框架的原因是浏览器的 URL 位置栏始终保持在 www.vendor.com。 (呃,别让我开始)。
问题是当我从 www.vendor.com 登录到我的网络应用程序时,我的网络应用程序加载到框架中,我的所有 CSS 和 Javascript 都没有加载。
这只发生在 IE7/8 中,我已经在 Firefox、Chrome、Opera 和 Safari 中对其进行了测试,它们中的每一个都确实会加载我的 CSS 和 JS 文件。
这是我的标题的样子:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="nl" xmlns:xf="http://www.w3.org/2002/xforms">
<head>
<title>My Webapp</title>
<meta http-equiv="Content-Type" content="text/html" />
<link rel="icon" href="/img/favicon.ico" />
<link rel="shortcut icon" href="/img/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/css.php?css=public" />
<script type="text/javascript" src="/js/js.php?js=public"></script>
</head>
<body>
我怀疑 IE 没有正确处理 CSS/JS 的相关 URL...
还有更奇怪的事情!如果我清除我的 IE 浏览缓存并且我首先通过该域登录到 www.webapp.com,然后在 IE 中通过 www.vendor.com 注销并登录,CSS/JS 会加载!什么……?我的整个 web 应用程序都驻留在 HTTPS 上,因此它不应该缓存任何资源...
我大吃一惊,所以我求助于在这里发帖..有人知道发生了什么吗?
编辑
好的,在我为 Internet Explorer 安装了适当的调试工具(而不是默认工具)后,我能够检查发送的 HTTP 标头。所以我比较了 IE 和 Firefox,结果如下:
IE 请求登录帖子到我的 web 应用
(Request-Line):POST /?portal&returnurl=www.vendor.com HTTP/1.1
Accept:application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Content-Type:application/x-www-form-urlencoded
Accept-Encoding:gzip, deflate
Host:www.webapp.nl
Content-Length:40
Connection:Keep-Alive
Cache-Control:no-cache
IE 响应
(Status-Line):HTTP/1.1 200 OK
Date:Wed, 14 Jul 2010 10:35:34 GMT
Server:Apache
X-Powered-By:PHP/5.1.6
**Set-Cookie:PHPSESSID=uiluornfipr2dk294iro09tgg6; path=/**
Expires:Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:no-cache
Set-Cookie:lang=0
Set-Cookie:lang=0
Connection:close
Transfer-Encoding:chunked
Content-Type:text/html; charset=UTF-8
IE CSS 请求:
(Request-Line):GET /css/css.php?css=portal HTTP/1.1
Accept:*/*
Host:www.webapp.nl
Connection:Keep-Alive
IE CSS 响应
(Status-Line):HTTP/1.1 200 OK
Date:Wed, 14 Jul 2010 10:35:35 GMT
Server:Apache
X-Powered-By:PHP/5.1.6
**Set-Cookie:PHPSESSID=pe2cio1vhu0shq2i497bjh5oa4; path=/**
Expires:Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:no-cache
Content-Length:0
Connection:close
Content-Type:text/html; charset=UTF-8
Firefox 请求登录帖子到我的网络应用
Host www.webapp.nl
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language nl,en-us;q=0.7,en;q=0.3
Accept-Encoding gzip,deflate
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive 115
Connection keep-alive
FF 回应
Date Wed, 14 Jul 2010 10:38:57 GMT
Server Apache
X-Powered-By PHP/5.1.6
**Set-Cookie PHPSESSID=re10rmqq7u723ht3719o9q5el3; path=/ lang=0 lang=0**
Expires Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma no-cache
Connection close
Transfer-Encoding chunked
Content-Type text/html; charset=UTF-8
FF CSS 请求
Host www.webapp.nl
Accept text/css,*/*;q=0.1
Accept-Language nl,en-us;q=0.7,en;q=0.3
Accept-Encoding gzip,deflate
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive 115
Connection keep-alive
**Cookie PHPSESSID=re10rmqq7u723ht3719o9q5el3; lang=0**
FF CSS 响应
Date Wed, 14 Jul 2010 10:38:57 GMT
Server Apache
X-Powered-By PHP/5.1.6
Expires Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma no-cache
Connection close
Transfer-Encoding chunked
Content-Type text/css; charset=utf-8
(为简洁起见删除了一些)
区别很明显。 IE 不会将 cookie 与 CSS 请求一起发送,即使它确实从登录响应中收到了 set-cookie。 Firefox 确实将 cookie 与 CSS 请求一起发送。 除非设置了有效的 cookie,否则我的 webapp 不会返回 CSS/Script。
所以,任何框架/cookie 专家都知道为什么 IE 不将它在第一个响应中收到的 cookie 发送到它正在加载的页面的进一步资源请求中?
块引用
【问题讨论】:
标签: javascript html css caching frames