<?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; browser</title>
	<atom:link href="http://julabs.me/blog/tags/browser/feed/" rel="self" type="application/rss+xml" />
	<link>http://julabs.me/blog</link>
	<description>想努力创造完美的东西，必须具备心灵的纯洁，同时富于宗教精神。</description>
	<lastBuildDate>Wed, 18 Jan 2012 06:34:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Ajax同步请求会临时锁住浏览器</title>
		<link>http://julabs.me/blog/synchronous-requests-lock-the-browser/</link>
		<comments>http://julabs.me/blog/synchronous-requests-lock-the-browser/#comments</comments>
		<pubDate>Sat, 17 Apr 2010 08:39:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[前端]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[browser]]></category>

		<guid isPermaLink="false">http://julabs.me/blog/front/ajax%e5%90%8c%e6%ad%a5%e8%af%b7%e6%b1%82%e4%bc%9a%e4%b8%b4%e6%97%b6%e9%94%81%e4%bd%8f%e6%b5%8f%e8%a7%88%e5%99%a8/</guid>
		<description><![CDATA[由于公司网页在加载时会用Ajax发送大量请求，服务器吃不消，就把Ajax请求设置为同步。但在页面加载时浏览器会出现停顿，刚开始我还以为是写的JavaScript效率不高，占用太多的内存，造成浏览器停顿现象。这两天无意中发现如果把Ajax请求设置为同步的话，浏览器会被临时锁住，在请求返回之前不能进行任何操作。它会临时中断所有的JavaScript命令，也不能点击按钮，甚至选择文本内容。 我是到这两天才发现这个问题的，和Ajax接触了这么多年才发现，看来我对Ajax基础知识了解地实在是太肤浅了，以后要加强基础知识的掌握了。关于Ajax的基础知识可以参看W3C的资料——《XMLHttpRequest》 解决方法可以参看《自动排队的异步Ajax请求》]]></description>
			<content:encoded><![CDATA[<p>由于公司网页在加载时会用<acronym title="Asynchronous JavaScript and XML">Ajax</acronym>发送大量请求，服务器吃不消，就把<acronym title="Asynchronous JavaScript and XML">Ajax</acronym>请求设置为同步。但在页面加载时浏览器会出现停顿，刚开始我还以为是写的<strong>JavaScript</strong>效率不高，占用太多的内存，造成浏览器停顿现象。这两天无意中发现如果把<acronym title="Asynchronous JavaScript and XML">Ajax</acronym>请求设置为同步的话，浏览器会被临时锁住，在请求返回之前不能进行任何操作。它会临时中断所有的<strong>JavaScript</strong>命令，也不能点击按钮，甚至选择文本内容。</p>
<p>我是到这两天才发现这个问题的，和<acronym title="Asynchronous JavaScript and XML">Ajax</acronym>接触了这么多年才发现，看来我对<acronym title="Asynchronous JavaScript and XML">Ajax</acronym>基础知识了解地实在是太肤浅了，以后要加强基础知识的掌握了。关于<acronym title="Asynchronous JavaScript and XML">Ajax</acronym>的基础知识可以参看<a href="http://www.w3.org/" target="_blank">W3C</a>的资料——<a href="http://www.w3.org/TR/XMLHttpRequest/" target="_blank">《XMLHttpRequest》</a></p>
<p>解决方法可以参看<a href="/blog/front/queue-asynchronous-ajax-request/">《自动排队的异步Ajax请求》</a></p>
]]></content:encoded>
			<wfw:commentRss>http://julabs.me/blog/synchronous-requests-lock-the-browser/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>用PHP侦测浏览器名称版本</title>
		<link>http://julabs.me/blog/php-browser-check/</link>
		<comments>http://julabs.me/blog/php-browser-check/#comments</comments>
		<pubDate>Sun, 27 Dec 2009 10:22:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[浏览器]]></category>

		<guid isPermaLink="false">http://julabs.me/blog/?p=122</guid>
		<description><![CDATA[现在的浏览器有很多种，每种又有不同的版本，为了让网页在不同的浏览器的呈现出相同的样式，页面制做人员便使用大量的偏方（即hack，我把它叫做偏方）。做这种事情是很痛苦的，做过的人都知道。于是有些人分别针对不同的浏览器编写相对应的CSS文件，然后用IE条件注释方式来判断载入，代码如下： &#60;link href=&#34;common.css&#34; type=&#34;text/css&#34; media=&#34;screen, projection&#34; /&#62; &#60;!--[if IE 7]&#62;&#60;link href=&#34;ie7.css&#34; type=&#34;text/css&#34; media=&#34;screen, projection&#34; /&#62; &#60;![endif]--&#62;&#60;!--[if IE 6]&#62;&#60;link href=&#34;ie6.css&#34; type=&#34;text/css&#34; media=&#34;screen, projection&#34; /&#62; &#60;![endif]--&#62; 其实也可以用后台动态语言来判断浏览器种类的。在PHP中可以使用函数&#8220;$_SERVER['HTTP_USER_AGENT']&#8221;，它和JS中的&#8220;navigator.userAgent&#8221;函数具有相似的功能，而且我在PHP官网上找到一篇介绍介绍get_browser函数的文章，在里面找到了不少判断浏览器种类的代码，现转一个在这里： &#60;?php // _______ // ----- &#124; CONF. &#124; // add new browsers in lower case &#8230; <a href="http://julabs.me/blog/php-browser-check/">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>现在的浏览器有很多种，每种又有不同的版本，为了让网页在不同的浏览器的呈现出相同的样式，页面制做人员便使用大量的偏方（即hack，我把它叫做偏方）。做这种事情是很痛苦的，做过的人都知道。于是有些人分别针对不同的浏览器编写相对应的CSS文件，然后用IE条件注释方式来判断载入，代码如下：</p>
<pre><code class="html">&lt;link href=&quot;common.css&quot; type=&quot;text/css&quot; media=&quot;screen, projection&quot; /&gt;
&lt;!--[if IE 7]&gt;&lt;link href=&quot;ie7.css&quot; type=&quot;text/css&quot; media=&quot;screen, projection&quot; /&gt;
&lt;![endif]--&gt;&lt;!--[if IE 6]&gt;&lt;link href=&quot;ie6.css&quot; type=&quot;text/css&quot; media=&quot;screen, projection&quot; /&gt;
&lt;![endif]--&gt;</code></pre>
<p>其实也可以用后台动态语言来判断浏览器种类的。在PHP中可以使用函数&ldquo;$_SERVER['HTTP_USER_AGENT']&rdquo;，它和JS中的&ldquo;navigator.userAgent&rdquo;函数具有相似的功能，而且我在<a href="http://www.php.net/" class="blank">PHP官网</a>上找到一篇<a href="http://us2.php.net/manual/en/function.get-browser.php" class="blank">介绍介绍get_browser函数的文章</a>，在里面找到了不少判断浏览器种类的代码，现转一个在这里：</p>
<pre><code class="php">&lt;?php
//        _______
// ----- &#124; CONF. &#124;
// add new browsers in lower case here, separated
// by spaces -  order is important: from left to
// right browser family becomes more precise$browsers = &quot;mozilla msie gecko firefox &quot;;
$browsers.= &quot;konqueror safari netscape navigator &quot;;
$browsers.= &quot;opera mosaic lynx amaya omniweb&quot;;
//        _______
// ----- &#124;PROCESS&#124;
$browsers = split(&quot; &quot;, $browsers);
$nua = strToLower( $_SERVER['HTTP_USER_AGENT']);
$l = strlen($nua);
for ($i=0; $i&lt;count($browsers); $i++){
	$browser = $browsers[$i];
	$n = stristr($nua, $browser);
	if(strlen($n)&gt;0){
		$GLOBALS[&quot;ver&quot;] = &quot;&quot;;
		$GLOBALS[&quot;nav&quot;] = $browser;
		$j=strpos($nua, $GLOBALS[&quot;nav&quot;])+$n+strlen($GLOBALS[&quot;nav&quot;])+1;
		for (; $j&lt;=$l; $j++){
			$s = substr ($nua, $j, 1);
			if(is_numeric($GLOBALS[&quot;ver&quot;].$s) )
			$GLOBALS[&quot;ver&quot;] .= $s;
			else
			break;
		}
	}
}
//        _______

// ----- &#124;  USE  &#124;

echo(&quot;&lt;pre&gt;Your browser is: &quot;);
echo($GLOBALS[&quot;nav&quot;] . &quot; &quot; . $GLOBALS[&quot;ver&quot;] . &quot;&lt;/pre&gt;&quot;);
?&gt;
</code></pre>
<p>如果你用的是IE6，页面会显示：Your browser is: msie 6.0；如果用的是火狐2，会显示：Your browser is: firefox 2.0。</p>
]]></content:encoded>
			<wfw:commentRss>http://julabs.me/blog/php-browser-check/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>用“document.compatMode”判断浏览器布局模式</title>
		<link>http://julabs.me/blog/javascript-browser-mode/</link>
		<comments>http://julabs.me/blog/javascript-browser-mode/#comments</comments>
		<pubDate>Sun, 27 Dec 2009 10:07:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[前端]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mode]]></category>

		<guid isPermaLink="false">http://julabs.me/blog/?p=120</guid>
		<description><![CDATA[在看mootools文档时，看到了“document.compatMode”，这句代码从未见过，一查原来它可以侦测游览器的布局模式（Layout）。布局模式一般分为标准模式（Standards Mode）和怪异模式（quirks mode），在标准模式中，浏览器根据W3C所定的标准规范来显示页面；而在怪异模式中，页面将以IE5，甚至IE4的显示页面的方式来表现，以兼容以非标准代码编写的网页，保持其能正常显示。关于模式的更多信息请参看aoao的《浏览器的模式问题 Quirks Mode vs Standards Mode》一文。 虽然可以兼容了，但也给网页制做带了一些麻烦，比如在获取页面可视区域的总高度时就要用“document.documentElement”来判断页面是以何种模式来布局的。个人认为用“document.compatMode”更简单点。“document.compatMode”有两个值，一个是“BackCompat”，对应怪异模式；一个是“CSS1Compat”，对应标准模式。]]></description>
			<content:encoded><![CDATA[<p>在看<a href="http://mootools.net" class="blank">mootools</a>文档时，看到了“document.compatMode”，这句代码从未见过，一查原来它可以侦测游览器的布局模式（Layout）。布局模式一般分为标准模式（Standards Mode）和怪异模式（quirks mode），在标准模式中，浏览器根据W3C所定的标准规范来显示页面；而在怪异模式中，页面将以IE5，甚至IE4的显示页面的方式来表现，以兼容以非标准代码编写的网页，保持其能正常显示。关于模式的更多信息请参看<a href="http://www.aoao.org.cn/" class="blank">aoao</a>的<a href="http://www.aoao.org.cn/blog/2007/01/browser-mode/" class="blank">《浏览器的模式问题 Quirks Mode vs Standards Mode》</a>一文。</p>
<p>虽然可以兼容了，但也给网页制做带了一些麻烦，比如在获取页面可视区域的总高度时就要用“document.documentElement”来判断页面是以何种模式来布局的。个人认为用“document.compatMode”更简单点。“document.compatMode”有两个值，一个是“BackCompat”，对应怪异模式；一个是“CSS1Compat”，对应标准模式。</p>
]]></content:encoded>
			<wfw:commentRss>http://julabs.me/blog/javascript-browser-mode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

