<?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>Lefter &#187; 浏览器</title>
	<atom:link href="http://lefter.net/blog/tag/%e6%b5%8f%e8%a7%88%e5%99%a8/feed/" rel="self" type="application/rss+xml" />
	<link>http://lefter.net/blog</link>
	<description>blog of lefter</description>
	<lastBuildDate>Fri, 20 Jan 2012 00:14:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>用XBL实现FireFox连续字符自动换行</title>
		<link>http://lefter.net/blog/word-break_for_firefox/</link>
		<comments>http://lefter.net/blog/word-break_for_firefox/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 10:03:26 +0000</pubDate>
		<dc:creator>lefter</dc:creator>
				<category><![CDATA[前端开发&架构]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[浏览器]]></category>

		<guid isPermaLink="false">http://lefter.net/blog/?p=973</guid>
		<description><![CDATA[一般来讲，在排版中,中文及一些亚洲国家的文字标点不会在每行的起始位置显示，一个完整的英文单词不会出现在两行中，因此当连续的文字过长是会破坏所在区域的布局；IE下有word-break和word... ]]></description>
			<content:encoded><![CDATA[<p>一般来讲，在排版中,中文及一些亚洲国家的文字标点不会在每行的起始位置显示，一个完整的英文单词不会出现在两行中，因此当连续的文字过长是会破坏所在区域的布局；IE下有<a href="http://www.w3.org/TR/css3-text/#word-wrap">word-break</a>和<a href="http://www.w3.org/TR/css3-text/#word-break">word-warp</a>来解决这个方法，但是Firefox不支持这两属性，用XBL能让Firefox达到相应的效果</p>
<p><a href="https://developer.mozilla.org/en/XBL">XBL</a>eXtensible Bindings Language也即是可扩展绑定语言,有点类似IE的HTC,HTC在CSS中的引用格式为：</p>
<pre><code>p{behavior:url(test.htc)}</code></pre>主要作用就是用来定义XUL组件的行为模式,XBL语法结构为：
<pre>
<code>&lt;?xml version="1.0"?>
&lt;bindings xmlns="http://www.mozilla.org/xbl">
  &lt;binding id="binding1">
    &lt;!-- content, property, method and event descriptions go here -->
  &lt;/binding>
  &lt;binding id="binding2">
    &lt;!-- content, property, method and event descriptions go here -->
  &lt;/binding>
&lt;/bindings>
</code>
</pre>
<p>
然后就可以通过Firefox的私有属性<a href="https://developer.mozilla.org/en/CSS/-moz-binding">-moz-binding</a> 将一个元素关联到一个XBL文件中的指定项上:</p>
<pre><code>p {
    -moz-binding:(url('lefter.net/demo/wordwrap.xml.xml#wordwrap');
}</code></pre>
<a href="/demo/FF_word_break.htm"><strong>Firefox演示效果</strong></a><br/>
<strong>推荐阅读</strong>
<ol>
<li><a href="https://developer.mozilla.org/en/CSS_Reference/Mozilla_Extensions">FireFox私有属性</a></li>
<li><a href="https://developer.mozilla.org/en/XBL">Firefox XBL</a></li>
<li><a href="http://blog.stchur.com/2007/02/22/emulating-css-word-wrap-for-mozillafirefox/">Emulating CSS word-wrap for Mozilla/Firefox</a></li>
<li><a href="http://www.hedgerwow.com/360/dhtml/css-word-break.html">Cross Browser Word Breaker</a></li>
<li><a href="http://dancewithnet.com/2008/12/04/word-break-all/">连续字体换行的解决方案</a></li>
</ol>
<ins datetime="2009-09-03T12:38:36+00:00">回家在自己的电脑上升级Firefox到Firefox/3.5.2，发现Firefox/3.5.2已经对word-breakz支持了，对text-shadow也已经支持了。</ins>]]></content:encoded>
			<wfw:commentRss>http://lefter.net/blog/word-break_for_firefox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>两种解决IE6不支持固定定位的方法</title>
		<link>http://lefter.net/blog/ie6_position_fixed/</link>
		<comments>http://lefter.net/blog/ie6_position_fixed/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 03:40:05 +0000</pubDate>
		<dc:creator>lujo</dc:creator>
				<category><![CDATA[前端开发&架构]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[浏览器]]></category>

		<guid isPermaLink="false">http://lefter.net/blog/?p=966</guid>
		<description><![CDATA[有两种让IE6支持position:fixed 1.用CSS执行表达式 *{margin:0;padding:0;} * html,* html body{ background-image:url(about:blank); background-attachment:fixed; } * html .fixed{ position:absolute; bottom:auto; top:expression(eval(document.documentE... ]]></description>
			<content:encoded><![CDATA[<h4>有两种让IE6支持position:fixed</h4>
<h3>1.用CSS执行表达式</h3>
<pre>
<code>*{margin:0;padding:0;}
* html,* html body{ 
	background-image:url(about:blank);
 	background-attachment:fixed;
}
* html .fixed{
    position:absolute;
    bottom:auto;
    top:expression(eval(document.documentElement.scrollTop+
    document.documentElement.clientHeight-this.offsetHeight-
    (parseInt(this.currentStyle.marginTop,10)||0)-
    (parseInt(this.currentStyle.marginBottom,10)||0)));
}      
.fixed{
    position:fixed;
    bottom:0px;
    top:auto;
}   
</code>
</pre>
<a href="/demo/IE6position_fix.htm"><strong>查看演示</strong></a>
<h3>2.让body保持其原有高度，让html只有一个窗口那么高</h3>
<pre><code>*{margin:0;padding:0}
*html{overflow:hidden;}
*html body{height:100%;overflow:auto;}        
.fixed{
    position:fixed; _position:absolute;
    left:0;
    bottom:0;
}</code>
</pre>
<a href="/demo/IE6positionfixed_bug.htm"><strong>查看演示</strong></a>
<p><strong>推荐阅读</strong> <br/><a href="http://tagsoup.com/cookbook/css/fixed/">http://tagsoup.com/cookbook/css/fixed/</a><br/><a href="http://subtlegradient.com/articles/2009/07/29/css_position_fixed_for_ie6.html">http://subtlegradient.com/</a></p>]]></content:encoded>
			<wfw:commentRss>http://lefter.net/blog/ie6_position_fixed/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>浏览器检测</title>
		<link>http://lefter.net/blog/check-agent/</link>
		<comments>http://lefter.net/blog/check-agent/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 10:30:44 +0000</pubDate>
		<dc:creator>lefter</dc:creator>
				<category><![CDATA[前端开发&架构]]></category>
		<category><![CDATA[浏览器]]></category>

		<guid isPermaLink="false">http://lefter.net/blog/?p=880</guid>
		<description><![CDATA[判断浏览器的型号一般有两种：一是可以通过DOM的userAgent来判断；另一种是通过浏览器的私有属性来判断 通过userAgent来判断 通过查找userAgent返回的字符串中一些特定的字符来判断浏览器类型,... ]]></description>
			<content:encoded><![CDATA[<p>判断浏览器的型号一般有两种：一是可以通过DOM的userAgent来判断；另一种是通过浏览器的私有属性来判断</p>
<h4>通过userAgent来判断</h4>
<p>通过查找userAgent返回的字符串中一些特定的字符来判断浏览器类型,可以通过indexOf()，返回值是所查找的字符串在整个字符串中首次出现的位置，没有找到要查的字符串其返回值是-1；indexOf()对大小写敏感，而userAgent方法返回值一般为大写混合，以下是常见浏览器的userAgent值</p>
<pre><code><strong>IE7</strong>:mozilla/4.0 (compatible; msie 7.0; windows nt 5.1; 
.net clr 2.0.50727; .net clr 3.0.04506.648; .net clr 3.5.21022; ciba)
<strong>IE6:</strong>mozilla/4.0 (compatible; msie 6.0; windows nt 5.1; 
.net clr 2.0.50727; .net clr 3.0.04506.648; .net clr 3.5.21022; ciba) 
<strong>FF</strong>:mozilla/5.0 (windows; u; windows nt 5.1; zh-cn; rv:1.9.0.10) 
gecko/2009042316 firefox/3.0.10 
<strong>Opera</strong>:opera/9.64 (windows nt 5.1; u; edition ibis; zh-cn) presto/2.1.1
<strong>Safari</strong>:mozilla/5.0 (windows; u; windows nt 5.1; zh-cn) 
applewebkit/528.16 (khtml, like gecko) version/4.0 safari/528.16
<strong>Chrome</strong>:mozilla/5.0 (windows; u; windows nt 5.1; en-us) applewebkit/531.3 
(khtml, like gecko) chrome/3.0.193.0 safari/531.3
</code></pre>
<p>对比上面返回值的差异可以用下面的方法对浏览器进行检查</p>
<pre><code>var ua = navigator.userAgent.toLowerCase();
var _isOpera = ua.indexOf('opera') != -1,
_isChrome = ua.indexOf('chrome') != -1,
_isSafari = !_isChrome &amp;&amp; ua.indexOf('safari') != -1,
_isGecko = !_isChrome &amp;&amp; !_isSafari &amp;&amp; ua.indexOf('gecko') != -1,
_isIE = !_isOpera &amp;&amp;ua.indexOf('msie') != -1, 
_isIE6 = ua.indexOf('msie 6') != -1,
_isIE7 = ua.indexOf('msie 7') != -1;		
</code></pre>
<p><a href="/demo/ua.html"><strong>点击查看示例</strong></a></p>
<h4>通过浏览器的私有属性来判断</h4>
<ul>
<li><strong>IE</strong>支持创建ActiveX控件，因此ActiveXObject函数也是IE独有的</li>
<li><strong>Opera</strong>提供了专门的浏览器标志，就是window.opera属性</li>
<li><strong>Safari</strong>有一个私有的openDatabase属性</li>
<li><strong>Chrome</strong>和Firefox有一个MessageEvent函数，但没有Firefox的getBoxObjectFor</li>
<li><strong>Firefox</strong>有一个getBoxObjectFor函数用来获取DOM的位置和大小,类似IE的getBoundingClientRect</li>
</ul>
<p>因此可以大概用一下代码</p>
<pre><code>var ua = navigator.userAgent.toLowerCase();
var _isOpera = window.opera,
_isChrome = window.MessageEvent &amp;&amp; !document.getBoxObjectFor,
_isSafari = window.openDatabase,
_isGecko = document.getBoxObjectFor,
_isIE = window.ActiveXObject;
if(_isIE ) alert("ie");
if(_isGecko ) alert("isGecko ");
if(_isChrome ) alert("isChrome ");
if(_isOpera ) alert("isOpera ");
if(_isSafari ) alert("isSafari ");</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://lefter.net/blog/check-agent/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>190 Bugs in  IE8 for Windows</title>
		<link>http://lefter.net/blog/190-bugs-in-8-for-windows/</link>
		<comments>http://lefter.net/blog/190-bugs-in-8-for-windows/#comments</comments>
		<pubDate>Fri, 07 Nov 2008 01:29:44 +0000</pubDate>
		<dc:creator>lujo</dc:creator>
				<category><![CDATA[体验&交互&平面&策划]]></category>
		<category><![CDATA[前端开发&架构]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[ie]]></category>
		<category><![CDATA[浏览器]]></category>

		<guid isPermaLink="false">http://ilujo.cn/?p=277</guid>
		<description><![CDATA[以前只是在css-discuss上的BrowserBugs上看到了一些总结性的BUG，positioniseverything上也有不少！今天看了一个更详细的,废话少说贴上地址！http://www.gtalbot.org/BrowserBugsSection 有兴趣的朋友去看看看！有... ]]></description>
			<content:encoded><![CDATA[<p>以前只是在<a href="http://css-discuss.incutio.com/" target="_blank">css-discuss</a>上的<a href="http://css-discuss.incutio.com/?page=BrowserBugs">BrowserBugs</a>上看到了一些总结性的BUG，<a href="http://www.positioniseverything.net/" target="_blank">positioniseverything</a>上也有不少！今天看了一个更详细的,废话少说贴上地址！<a href="http://www.gtalbot.org/BrowserBugsSection/">http://www.gtalbot.org/BrowserBugsSection</a><br />
<img  title="bug5s4g8" src="http://lefter.net/blog/wp-content/uploads/2008/11/bug5s4g8-650x336.jpg" width="550" /></p>
<p>有兴趣的朋友去看看看！有个疑问了，为什么IE的版本越到后来，bug越多呢？</p>
]]></content:encoded>
			<wfw:commentRss>http://lefter.net/blog/190-bugs-in-8-for-windows/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Quirks模式与Standards模式</title>
		<link>http://lefter.net/blog/quirks-standards/</link>
		<comments>http://lefter.net/blog/quirks-standards/#comments</comments>
		<pubDate>Fri, 31 Oct 2008 00:50:30 +0000</pubDate>
		<dc:creator>lujo</dc:creator>
				<category><![CDATA[前端开发&架构]]></category>
		<category><![CDATA[浏览器]]></category>

		<guid isPermaLink="false">http://ilujo.cn/?p=268</guid>
		<description><![CDATA[如何进入Standards模式? 一般来讲浏览器是通过DTD来判断模式的；浏览器进入Standards模式的DTD有：HTML的strict.dtd和loose.dtd这两个DTD的简单区别是 strict去掉了许多表现的标签，有利于结构和表现的分... ]]></description>
			<content:encoded><![CDATA[<h3>如何进入Standards模式?</h3>
<p>一般来讲浏览器是通过DTD来判断模式的；浏览器进入Standards模式的DTD有：HTML的strict.dtd和loose.dtd这两个DTD的简单区别是</p>
<ul>
<li>strict去掉了许多表现的标签，有利于结构和表现的分离</li>
<li>loose会导致Firefox进入Almost Standards模式，在图片的处理上会有微小的差别</li>
</ul>
<p><strong>在IE6下，如果在DTD之前有任何字符都将导致其进入quirks模式</strong><br />
<img style="width: 550px;" src="http://lefter.net/blog/wp-content/uploads/2008/10/quirks-standards_html_m5ab95b5f-650x418.png" alt="" /></p>
<h3>Quirks模式与Standards模式的区别</h3>
<p>quirks和standards的区别很多都可以归为IE5和IE6的区别。</p>
<dl>
<dt>盒模型的高宽包含内补丁和边框</dt>
<dd>在W3C标准中，如果设置一个元素的宽度和高度，指的是元素内容的宽度和高度，而在Quirks模式下，IE的宽度和高度还包含了padding和border。IE5.5及以下的浏览器即使在Standards模式下，也会有这个问题</dd>
<dt>可以设置行内元素的高宽</dt>
<dd>在Standards模式下，给span等行内元素设置wdith和height都不会生效，而在quirks模式下，则会生效</dd>
<dt>可设置百分比的高度</dt>
<dd>在standards模式下，一个元素的高度是由其包含的内容来决定的，如果父元素没有设置百分比的高度，子元素设置一个百分比的高度是无效的</dd>
<dt>用margin:0 auto设置水平居中在IE下会失效</dt>
<dd>使用margin:0 auto在standards模式下可以使元素水平居中，但在quirks模式下却会失效,quirk模式下的解决办法，用text-align属性:
<pre><code>body{text-align:center};#{content:text-align:left}</code></pre>
</dd>
<dt>设置图片的padding会失效</dt>
<dt>Table中的字体属性不能继承上层的设置</dt>
<dt>white-space: pre会失效</dt>
<dt>许多CSS默认样式将不同</dt>
<dd>在Standards模式下，给span等行内元素设置wdith和height都不会生效，而在quirks模式下，则会生效</dd>
<dt>JavaScript中的区别</dt>
<dd>Quirks mode的<a href="http://www.quirksmode.org/js/doctypes.html">Table of measurements</a></dd>
</dl>
<h4>参考</h4>
<ul>
<li><a href="http://www.quirksmode.org/js/doctypes.html">Table of measurements</a></li>
<li><a href="http//msdn2.microsoft.com/en-us/library/bb250395.aspx">MSDN</a></li>
</ul>
<p><ins datetime="2009-08-25T06:16:22+00:00">dom中的document有一个属性叫compatMode,其返回值是BackCompat和CSS1Compat，分别对应quirks mode和strict mode</ins>
<pre><code>void function(){
var mode=document.compat
if (mode="BackCompat")
alert("当前以quirks mode的方式渲染页面");
else if(mode="CSS1Compat")
alert("当前已strict mode的方式渲染页面");
else alert("浏览器版本不支持compatMode");
}()</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://lefter.net/blog/quirks-standards/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

