<?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>李文兵 &#187; firefox javascript local file policy cross domain</title>
	<atom:link href="http://liwenbing.cn/tag/firefox-javascript-local-file-policy-cross-domain/feed/" rel="self" type="application/rss+xml" />
	<link>http://liwenbing.cn</link>
	<description>世界上最好最美的东西你看不见，也摸不着.......但是能在心里感受到</description>
	<lastBuildDate>Fri, 21 May 2010 00:56:29 +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>为什么Firefox 3不能加载本地的JavaScript文件了？</title>
		<link>http://liwenbing.cn/2009/06/05/why-ff3-cannot-load-local-javascript-file/</link>
		<comments>http://liwenbing.cn/2009/06/05/why-ff3-cannot-load-local-javascript-file/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 08:36:38 +0000</pubDate>
		<dc:creator>liwenbing</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[firefox javascript local file policy cross domain]]></category>

		<guid isPermaLink="false">http://liwenbing.cn/?p=191</guid>
		<description><![CDATA[一段时间来一直受这样的困扰，就是我的Firefox无法运行本地的dojo的测试文件。一直以为是我的firefox或者机器出了什么问题，就只好去使用IE或者Chrome去运行这些测试例子，可惜不能用firebug的确让人很不爽。 今天在firebug查看了一些错误情况，报错居然是“Access to restricted URI denied”。这个明显是跨域访问的错误，但是本地文件怎么报这样的错呢？在Firefox的about:config搜索了一下policy,居然找到了原因所在，原来Firefox对于本地文件也进行了同源访问的安全设置,配置参数是：security.fileuri.strict_origin_policy。这个新的设置只是在firefox 3才被加入，并且默认是开启的。不过你也可以将这个关掉，这样就可以如同以前那样运行本地的dojo测试用例，或者其它你想本地加载的JavaScript文件。 继续在google了一下，找了这个&#8221;feature&#8221;的由来，https://bugzilla.mozilla.org/show_bug.cgi?id=230606，大概是说本地的文件如果没有这样的限制，可以访问本机的其他文件，这样会造成安全隐患。John Resig（Father of  jQuery) 也有一个blog关于这个问题，http://ejohn.org/blog/tightened-local-file-security/，下面的评论也挺值得看看的。 More Links: http://www.dojotoolkit.org/support/faq/why-does-dojo-fail-load-file-urls-firefox-3 http://kb.mozillazine.org/Security.fileuri.origin_policy http://kb.mozillazine.org/Security.fileuri.strict_origin_policy]]></description>
			<content:encoded><![CDATA[<p>一段时间来一直受这样的困扰，就是我的Firefox无法运行本地的dojo的测试文件。一直以为是我的firefox或者机器出了什么问题，就只好去使用IE或者Chrome去运行这些测试例子，可惜不能用firebug的确让人很不爽。</p>
<p>今天在firebug查看了一些错误情况，报错居然是“<span class="objectBox objectBox-text">Access to restricted URI denied”。这个明显是</span>跨域访问的错误，但是本地文件怎么报这样的错呢？在Firefox的about:config搜索了一下policy,居然找到了原因所在，原来Firefox对于本地文件也进行了同源访问的安全设置,配置参数是：security.fileuri.strict_origin_policy。这个新的设置只是在firefox 3才被加入，并且默认是开启的。不过你也可以将这个关掉，这样就可以如同以前那样运行本地的dojo测试用例，或者其它你想本地加载的JavaScript文件。</p>
<p><a rel="attachment wp-att-194" href="http://liwenbing.cn/2009/06/05/why-ff3-cannot-load-local-javascript-file/local-file-p-origin-policy/"><img class="alignnone size-medium wp-image-194" title="local-file-p-origin-policy" src="http://liwenbing.cn/wp-content/uploads/2009/06/local-file-p-origin-policy-300x42.png" alt="local-file-p-origin-policy" width="300" height="42" /></a></p>
<p>继续在google了一下，找了这个&#8221;feature&#8221;的由来，<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=230606" target="_blank">https://bugzilla.mozilla.org/show_bug.cgi?id=230606</a>，大概是说本地的文件如果没有这样的限制，可以访问本机的其他文件，这样会造成安全隐患。John Resig（Father of  jQuery) 也有一个blog关于这个问题，<a href="http://ejohn.org/blog/tightened-local-file-security/" target="_blank">http://ejohn.org/blog/tightened-local-file-security/</a>，下面的评论也挺值得看看的。</p>
<p><strong>More Links: </strong></p>
<ul>
<li><a href="http://www.dojotoolkit.org/support/faq/why-does-dojo-fail-load-file-urls-firefox-3">http://www.dojotoolkit.org/support/faq/why-does-dojo-fail-load-file-urls-firefox-3</a></li>
<li><a href="http://kb.mozillazine.org/Security.fileuri.origin_policy">http://kb.mozillazine.org/Security.fileuri.origin_policy</a></li>
<li><a href="http://kb.mozillazine.org/Security.fileuri.strict_origin_policy">http://kb.mozillazine.org/Security.fileuri.strict_origin_policy</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://liwenbing.cn/2009/06/05/why-ff3-cannot-load-local-javascript-file/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
