<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Big toy for boy! &#187; cookie</title>
	<atom:link href="http://bigtoy4boy.com/blog/tag/cookie/feed/" rel="self" type="application/rss+xml" />
	<link>http://bigtoy4boy.com/blog</link>
	<description>一个有关一些个人兴趣爱好的博客</description>
	<lastBuildDate>Wed, 04 Aug 2010 08:47:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>iframe下Cookie，top.window.location针对域名的权限</title>
		<link>http://bigtoy4boy.com/blog/2008/08/cookie-permission-in-iframe-cross-domain/</link>
		<comments>http://bigtoy4boy.com/blog/2008/08/cookie-permission-in-iframe-cross-domain/#comments</comments>
		<pubDate>Tue, 19 Aug 2008 09:28:24 +0000</pubDate>
		<dc:creator>羽高</dc:creator>
				<category><![CDATA[互联网技术]]></category>
		<category><![CDATA[cookie]]></category>
		<category><![CDATA[iframe]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[权限]]></category>
		<category><![CDATA[跨域名]]></category>

		<guid isPermaLink="false">http://www.bigtoy4boy.com/blog/?p=10</guid>
		<description><![CDATA[Cookie： IE里面有严格的Cookie访问权限，通常我们所知的，域名需要相同才会访问到对应的cookie。例 如：http://www.163.com种下的cookie，http://www.foo.com是访问不到的。其次http: //blog.163.com也是访问不到的，除非种cookie的时候写的是163.com域。 IE下跨域的iframe内的 cookie也是不生效的，iframe内的代码无法进行cookie操作，如果要强行激活的话，需要在请求头加入如下代码：P3P: CP=&#8221;CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR&#8221;。 在php里面就是这么写：header(&#8216;P3P: CP=&#8221;CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR&#8221;&#8216;); window.location: 我 们再来说说iframe嵌套页面跳转刷新整个top窗口，这里面也有域名方面的限制，如果是跨域是无法跳转的，同域名但是三级域名不一样的应用理论上也不 行。如果需要同域名跳转的话，可以在父级、子级页面上写js：document.domain=&#8217;163.com&#8217;;这样浏览器就按照二级域名同样的情况 允许跳转了。 跨域怎么办？两个服务都是你来控制的，肯定是有解决方案的。子级先跳转到和父级同域名下一个指定文件，那个文件再通过参数调用top.window.location来跳转整个页面到指定位置。 举 例来说有两个站点a.com, b.com。a.com 通过iframe嵌套b.com的内容。这时候需要b.com做一定操作后刷新整个页面到a.com的目标页a.com/target.html。这时候 [...]]]></description>
			<content:encoded><![CDATA[<p>Cookie：</p>
<p>IE里面有严格的Cookie访问权限，通常我们所知的，域名需要相同才会访问到对应的cookie。例 如：http://www.163.com种下的cookie，http://www.foo.com是访问不到的。其次http: //blog.163.com也是访问不到的，除非种cookie的时候写的是163.com域。</p>
<p>IE下跨域的iframe内的 cookie也是不生效的，iframe内的代码无法进行cookie操作，如果要强行激活的话，需要在请求头加入如下代码：P3P: CP=&#8221;CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR&#8221;。</p>
<p>在php里面就是这么写：header(&#8216;P3P: CP=&#8221;CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR&#8221;&#8216;);</p>
<p>window.location:</p>
<p>我 们再来说说iframe嵌套页面跳转刷新整个top窗口，这里面也有域名方面的限制，如果是跨域是无法跳转的，同域名但是三级域名不一样的应用理论上也不 行。如果需要同域名跳转的话，可以在父级、子级页面上写js：document.domain=&#8217;163.com&#8217;;这样浏览器就按照二级域名同样的情况 允许跳转了。</p>
<p>跨域怎么办？两个服务都是你来控制的，肯定是有解决方案的。子级先跳转到和父级同域名下一个指定文件，那个文件再通过参数调用top.window.location来跳转整个页面到指定位置。</p>
<p>举 例来说有两个站点a.com, b.com。a.com 通过iframe嵌套b.com的内容。这时候需要b.com做一定操作后刷新整个页面到a.com的目标页a.com/target.html。这时候 就要这样的顺序，先b.com本帧跳转到a.com/redirect.html?r=a.com/target.html，在 redirect.html里面再调用top.window.location导致整个页面刷新到传入的参数a.com/target.html</p>
]]></content:encoded>
			<wfw:commentRss>http://bigtoy4boy.com/blog/2008/08/cookie-permission-in-iframe-cross-domain/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
