aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/mozilla/firefox/releases/1.5
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/mozilla/firefox/releases/1.5
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/mozilla/firefox/releases/1.5')
-rw-r--r--files/zh-cn/mozilla/firefox/releases/1.5/index.html123
-rw-r--r--files/zh-cn/mozilla/firefox/releases/1.5/using_firefox_1.5_caching/index.html184
2 files changed, 307 insertions, 0 deletions
diff --git a/files/zh-cn/mozilla/firefox/releases/1.5/index.html b/files/zh-cn/mozilla/firefox/releases/1.5/index.html
new file mode 100644
index 0000000000..a028828a01
--- /dev/null
+++ b/files/zh-cn/mozilla/firefox/releases/1.5/index.html
@@ -0,0 +1,123 @@
+---
+title: Firefox 1.5 for developers
+slug: Mozilla/Firefox/Releases/1.5
+tags:
+ - Add-ons
+ - CSS
+ - DOM
+ - Extensions
+ - HTML
+ - JavaScript
+ - NeedsTranslation
+ - RDF
+ - SVG
+ - TopicStub
+ - Web Development
+ - Web Standards
+ - XML
+ - XML Web Services
+ - XSLT
+ - XUL
+translation_of: Mozilla/Firefox/Releases/1.5
+---
+<div>{{FirefoxSidebar}}</div><p>Based on the <a href="/en-US/docs/Gecko" title="en-US/docs/Gecko">Gecko</a> 1.8 engine, Firefox 1.5 improved its already best in class standards support, and provided new capabilities to enable the next generation of web applications. Firefox 1.5 features improved support for CSS2 and CSS3, APIs for scriptable and programmable 2D graphics through <a href="/en-US/docs/SVG" title="en-US/docs/SVG">SVG</a> 1.1 and <a class="internal" href="/en-US/docs/HTML/Canvas" title="en-US/docs/HTML/Canvas"><code>&lt;canvas&gt;</code></a>, <a href="/en-US/docs/XForms" title="en-US/docs/XForms">XForms</a> and XML events, as well as many DHTML, JavaScript, and DOM enhancements.</p>
+
+<h2 id="Developer_Tools">Developer Tools</h2>
+
+<p>Several tools and browser extensions are available to help developers support Firefox 1.5.</p>
+
+<ul>
+ <li><a href="/en-US/docs/DOM_Inspector" title="en-US/docs/DOM_Inspector">DOM Inspector</a>, a tool that allows developers to inspect and modify documents without having to edit the document directly. DOM Inspector is available as part of the Custom install option in Firefox 1.5 under Developer Tools.</li>
+ <li>JavaScript console, a tool to write and test JavaScript code as well as view JavaScript and CSS errors on a page.</li>
+ <li>View page source, with syntax highlighting and find features.</li>
+ <li><a class="link-https" href="https://addons.mozilla.org/extensions/showlist.php?application=firefox&amp;category=Developer%20Tools">Browser extensions</a> including the <a class="external" href="http://www.joehewitt.com/software/firebug/">FireBug</a>, <a href="/en-US/docs/Web_Developer_Extension_(external)" title="en-US/docs/Web_Developer_Extension_(external)">Web Developer toolbar</a>, <a href="/en-US/docs/Live_HTTP_Headers_(external)" title="en-US/docs/Live_HTTP_Headers_(external)">Live HTTP Headers</a>, <a href="/en-US/docs/HTML_Validator_(external)" title="en-US/docs/HTML_Validator_(external)">HTML Validator</a> and many more.</li>
+</ul>
+
+<p><strong>Note:</strong> Some extensions do not currently support Firefox 1.5, and will be automatically disabled.</p>
+
+<h2 id="Overview">Overview</h2>
+
+<p>Some of the new features in Firefox 1.5:</p>
+
+<h3 id="Web_site_and_application_developers">Web site and application developers</h3>
+
+<dl>
+ <dt><a href="/en-US/docs/SVG_In_HTML_Introduction" title="en-US/docs/SVG_In_HTML_Introduction">SVG In XHTML Introduction</a></dt>
+ <dd>Learn how to use SVG in XHTML pages and how to use JavaScript and CSS to manipulate the picture in the same way you would script regular XHTML. See also <a href="/en-US/docs/SVG_in_Firefox" title="en-US/docs/SVG_in_Firefox">SVG in Firefox</a> to learn about the status and known problems of SVG implementation in Firefox.</dd>
+ <dt><a href="/en-US/docs/HTML/Canvas/Drawing_Graphics_with_Canvas" title="en-US/docs/Drawing_Graphics_with_Canvas">Drawing Graphics with Canvas</a></dt>
+ <dd>Learn about the new <code>&lt;canvas&gt;</code> tag and how to draw graphs and other objects in Firefox.</dd>
+ <dt><a href="/en-US/docs/CSS/Using_CSS_multi-column_layouts" title="en-US/docs/CSS3_Columns">CSS3 Columns</a></dt>
+ <dd>Learn about the new support for automatic multi-column text layout as proposed for <a href="/en-US/docs/CSS/CSS3" title="CSS3">CSS3</a>.</dd>
+ <dt><a href="/en-US/docs/Using_Firefox_1.5_caching" title="en-US/docs/Using_Firefox_1.5_caching">Using Firefox 1.5 caching</a></dt>
+ <dd>Learn about <code>bfcache</code> and how it speeds up back and forward navigation.</dd>
+</dl>
+
+<h3 id="XUL_and_Extension_Developers">XUL and Extension Developers</h3>
+
+<dl>
+ <dt><a href="/en-US/docs/Building_an_Extension" title="en-US/docs/Building_an_Extension">Building an Extension</a></dt>
+ <dd>This tutorial will take you through the steps required to build a very basic extension for Firefox. Also see <a class="external" href="http://kb.mozillazine.org/Getting_started_with_extension_development">another tutorial on MozillaZine knowledge base</a>, which demonstrates the new features of the Extension Manager in 1.5 that make creating a new extension even easier.</dd>
+ <dt><a href="/en-US/docs/XPCNativeWrapper" title="en-US/docs/XPCNativeWrapper">XPCNativeWrapper</a></dt>
+ <dd><code>XPCNativeWrapper</code> is a way to wrap up an object so that it's <a href="/en-US/docs/Safely_accessing_content_DOM_from_chrome" title="en-US/docs/Safely_accessing_content_DOM_from_chrome">safe to access from privileged code</a>. It can be used in all Firefox versions, though the behavior changed somewhat starting with Firefox 1.5 (Gecko 1.8).</dd>
+ <dt><a href="/en-US/docs/Preferences_System" title="en-US/docs/Preferences_System">Preferences System</a></dt>
+ <dd>Learn about the new widgets that allow you to create Options windows easier using less JavaScript code.</dd>
+ <dt><a href="/en-US/docs/International_characters_in_XUL_JavaScript" title="en-US/docs/International_characters_in_XUL_JavaScript">International characters in XUL JavaScript</a></dt>
+ <dd>XUL JavaScript files can now contain non-ASCII characters.</dd>
+ <dt><a href="/en-US/docs/Tree_Widget_Changes" title="en-US/docs/Tree_Widget_Changes">Tree API changes</a></dt>
+ <dd>The interfaces for accessing XUL <code>&lt;tree&gt;</code> elements have changed.</dd>
+ <dt><a href="/en-US/docs/XUL_Changes_for_Firefox_1.5" title="en-US/docs/XUL_Changes_for_Firefox_1.5">XUL Changes for Firefox 1.5</a></dt>
+ <dd>Summary of XUL changes. See also <a href="/en-US/docs/Adapting_XUL_Applications_for_Firefox_1.5" title="en-US/docs/Adapting_XUL_Applications_for_Firefox_1.5">Adapting XUL Applications for Firefox 1.5</a>.</dd>
+</dl>
+
+<h4 id="Networking-related_changes">Networking-related changes</h4>
+
+<ul>
+ <li>Certificate prompts can now be overridden on a per-channel basis. This works by setting an interface requestor as an <a href="/en-US/docs/nsIChannel" title="en-US/docs/nsIChannel">nsIChannel</a>'s notificationCallbacks and giving out an interface for <a href="/en-US/docs/NsIBadCertListener" title="en-US/docs/NsIBadCertListener">nsIBadCertListener</a>.</li>
+ <li>nsIWebBrowserPersist's listeners can now implement <a href="/en-US/docs/XPCOM_Interface_Reference/nsIInterfaceRequestor" title="en-US/docs/nsIInterfaceRequestor">nsIInterfaceRequestor</a>::GetInterface and will get an opportunity to provide all interfaces that channels might ask for, including <a href="/en-US/docs/NsIProgressEventSink" title="en-US/docs/NsIProgressEventSink">nsIProgressEventSink</a> (not too useful, redundant with <a href="/en-US/docs/nsIWebProgressListener" title="en-US/docs/nsIWebProgressListener">nsIWebProgressListener</a>). Useful interfaces here include <a href="/en-US/docs/NsIChannelEventSink" title="en-US/docs/NsIChannelEventSink">nsIChannelEventSink</a> and <a href="/en-US/docs/NsIBadCertListener" title="en-US/docs/NsIBadCertListener">nsIBadCertListener</a>.</li>
+ <li>Extensions or other necko consumers, including XMLHttpRequest, can set a Cookie header explicitly, and necko will not replace it. Stored cookies will be merged with the explicitly set header, in a way that the explicit header will override the stored cookies.</li>
+</ul>
+
+<h2 id="New_End_user_Features">New End user Features</h2>
+
+<h3 id="User_Experience">User Experience</h3>
+
+<ul>
+ <li><strong>Faster browser navigation</strong> with improvements to back and forward button performance.</li>
+ <li><strong>Drag and drop reordering for browser tabs.</strong></li>
+ <li><strong>Answers.com is added to the search engine list</strong> for dictionary lookup.</li>
+ <li><strong>Improvements to product usability</strong> including descriptive error pages, redesigned options menu, RSS discovery, and "Safe Mode" experience.</li>
+ <li><strong>Better accessibility support</strong> including DHTML accessibility.</li>
+ <li><strong>Report a broken Web site wizard</strong> to report Web sites that are not working in Firefox.</li>
+ <li><strong>Better support for Mac OS X</strong> (10.2 and greater) including profile migration from Safari and Mac Internet Explorer.</li>
+</ul>
+
+<h3 id="Security_and_Privacy">Security and Privacy</h3>
+
+<ul>
+ <li><strong>Automated update</strong> to streamline product upgrades. Notification of an update is more prominent, and updates to Firefox may now be half a megabyte or smaller. Updating extensions has also improved.</li>
+ <li><strong>Improvements to popup blocking.</strong></li>
+ <li><strong>Clear Private Data</strong> feature provides an easy way to quickly remove personal data through a menu item or keyboard shortcut.</li>
+</ul>
+
+<h3 id="Support_for_open_Web_standards">Support for open Web standards</h3>
+
+<p>Firefox support for Web standards continues to lead the industry with consistent cross-platform implementations for:</p>
+
+<ul>
+ <li>Hypertext Markup Language (<a href="/en-US/docs/HTML" title="en-US/docs/HTML">HTML</a>) and Extensible Hypertext Markup Language (<a href="/en-US/docs/XHTML" title="en-US/docs/XHTML">XHTML</a>): <a class="external" href="http://www.w3.org/TR/html401/">HTML 4.01</a> and <a class="external" href="http://www.w3.org/TR/xhtml1/">XHTML 1.0/1.1</a></li>
+ <li>Cascading Style Sheets (<a href="/en-US/docs/CSS" title="en-US/docs/CSS">CSS</a>): <a class="external" href="http://www.w3.org/TR/REC-CSS1">CSS Level 1</a>, <a class="external" href="http://www.w3.org/TR/REC-CSS2">CSS Level 2</a> and parts of <a class="external" href="http://www.w3.org/Style/CSS/current-work.html">CSS Level 3</a></li>
+ <li>Document Object Model (<a href="/en-US/docs/DOM" title="en-US/docs/DOM">DOM</a>): <a class="external" href="http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/">DOM Level 1</a>, <a class="external" href="http://www.w3.org/DOM/DOMTR#dom2">DOM Level 2</a> and parts of <a class="external" href="http://www.w3.org/DOM/DOMTR#dom3">DOM Level 3</a></li>
+ <li>Mathematical Markup Language: <a class="external" href="http://www.w3.org/Math/">MathML Version 2.0</a></li>
+ <li>Extensible Markup Language (<a href="/en-US/docs/XML" title="en-US/docs/XML">XML</a>): <a class="external" href="http://www.w3.org/TR/REC-xml">XML 1.0</a>, <a class="external" href="http://www.w3.org/TR/REC-xml-names/">Namespaces in XML</a>, <a class="external" href="http://www.w3.org/TR/xml-stylesheet/">Associating Style Sheets with XML Documents 1.0</a>, <a class="external" href="http://lists.w3.org/Archives/Public/www-xml-linking-comments/2001AprJun/att-0074/01-NOTE-FIXptr-20010425.htm">Fragment Identifier for XML</a></li>
+ <li>XSL Transformations (<a href="/en-US/docs/XSLT" title="en-US/docs/XSLT">XSLT</a>): <a class="external" href="http://www.w3.org/TR/xslt">XSLT 1.0</a></li>
+ <li>XML Path Language (<a href="/en-US/docs/XPath" title="en-US/docs/XPath">XPath</a>): <a class="external" href="http://www.w3.org/TR/xpath">XPath 1.0</a></li>
+ <li>Resource Description Framework (<a href="/en-US/docs/RDF" title="en-US/docs/RDF">RDF</a>): <a class="external" href="http://www.w3.org/RDF/">RDF</a></li>
+ <li>Simple Object Access Protocol (SOAP): <a class="external" href="http://www.w3.org/TR/SOAP/">SOAP 1.1</a></li>
+ <li><a href="/en-US/docs/JavaScript" title="en-US/docs/JavaScript">JavaScript</a> 1.6, based on <a href="/en-US/docs/ECMAScript" title="en-US/docs/ECMAScript">ECMA-262</a>, revision 3: <a class="external" href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">ECMA-262</a></li>
+</ul>
+
+<p>Firefox 1.5 supports the following data transport protocols (HTTP, FTP, SSL, TLS, and others), multilingual character data (Unicode), graphics (GIF, JPEG, PNG, SVG, and others) and the latest version of the world's most popular scripting language, <a href="/en-US/docs/New_in_JavaScript_1.6" title="en-US/docs/New_in_JavaScript_1.6">JavaScript 1.6</a>.</p>
+
+<h2 id="Changes_since_Firefox_1.0">Changes since Firefox 1.0</h2>
+
+<p>Many changes have been introduced into Firefox since it was first released on November 9, 2004. Firefox has progressed with many new features and bug fixes. A detailed list of changes is available from <a class="external" href="http://www.squarefree.com/burningedge/releases/1.5-comprehensive.html">squarefree.com</a>.</p>
diff --git a/files/zh-cn/mozilla/firefox/releases/1.5/using_firefox_1.5_caching/index.html b/files/zh-cn/mozilla/firefox/releases/1.5/using_firefox_1.5_caching/index.html
new file mode 100644
index 0000000000..b062c43ddd
--- /dev/null
+++ b/files/zh-cn/mozilla/firefox/releases/1.5/using_firefox_1.5_caching/index.html
@@ -0,0 +1,184 @@
+---
+title: Using Firefox 1.5 caching
+slug: Mozilla/Firefox/Releases/1.5/Using_Firefox_1.5_caching
+translation_of: Mozilla/Firefox/Releases/1.5/Using_Firefox_1.5_caching
+---
+<div>{{FirefoxSidebar}}</div><h2 id="Introduction" name="Introduction">介绍</h2>
+
+<p><a href="/en-US/docs/Firefox_1.5_for_developers" title="Firefox_1.5_for_developers">Firefox 1.5</a> 对整个web页面的一个浏览器会话进行了内存缓存,包括他们对JavaScript状态。在访问过的页面间后退和前进不需要页面加载同时保存JavaScript状态。这个特性,被称为bfcache(“后退前进缓存”),使得页面导航(切换)非常快。这个状态缓存被保存直到用户关闭浏览器。 </p>
+
+<p>有时候,Firefox不缓存页面。下面是一些页面不被缓存的常见的编程的原因:</p>
+
+<ul>
+ <li>页面使用 <code>unload</code> 或者 <code>beforeunload</code> 处理程序;</li>
+ <li>页面设置 "cache-control: no-store".</li>
+ <li>页面是 HTTPS 同时页面至少有一个以下设置:
+ <ul>
+ <li>"Cache-Control: no-cache"</li>
+ <li>"Pragma: no-cache"</li>
+ <li>使用 "Expires: 0" 或者 "Expires" 设置相对于 “Date” header值的过去日期值(除非指定 "Cache-Control: max-age=");</li>
+ </ul>
+ </li>
+ <li>当用户导航跳离页面时页面还没有完全加载或者因为其他原因有等待(pending)的网络请求 (例如 <code>XMLHttpRequest</code>));</li>
+ <li>页面运行IndexedDB事件;</li>
+ <li>顶级页面包含frames (例如 {{HTMLElement("iframe")}})因为这里列出的任何原因 而没有被缓存;</li>
+ <li>页面是在frame内而且用户在这个框架中加载一个新页面(在这种情况下, 当用户离开这个页面,最后加载入frames的内容会被缓存)。</li>
+</ul>
+
+<p>这个新的缓存特性改变了页面的加载行为,web作者也许希望: </p>
+
+<ul>
+ <li>知晓被导航到的页面(当它从用户缓存中被加载)</li>
+ <li>在用户离开页面时定义页面行为  (同时还支持页面缓存)</li>
+</ul>
+
+<p>两个新的浏览器事件使得用户可以做到这2个要求。</p>
+
+<h2 id="New_browser_events" name="New_browser_events">新的浏览器事件</h2>
+
+<p>如果你使用新的事件,你的页面在其他浏览器依然会正确显示  (我们已经测试了早期版本的Firefox, Internet Explorer, Opera, 和 Safari),而且在 Firefox 1.5加载时将会使用新的缓存功能。</p>
+
+<p>注意: 直至10-2009 开发版本的Safari 添加了这些新的事件的支持 (见 <a class="link-https" href="https://bugs.webkit.org/show_bug.cgi?id=28758" title="https://bugs.webkit.org/show_bug.cgi?id=28758">the webkit bug</a>).</p>
+
+<p>标准的页面行为是:</p>
+
+<ol>
+ <li>用户导航至一个页面</li>
+ <li>当页面加载,行内scripts执行。</li>
+ <li>一旦页面加载完毕, <code>onload</code> 事件执行。</li>
+</ol>
+
+<p>有些页面包含第四步。如果一个页面使用 <code>unload</code> 或者 <code>beforeunload</code> 处理程序,当从页面导航离开时事件被执行。如果提供了一个<code>unload</code> 处理程序,页面将不会被缓存。</p>
+
+<p>当一个用户导航至一个被缓存的页面,行内scripts和<code>onload</code> 处理程序将不会执行 (步骤 2 和 3), 因为在大多数情况下,这些scripts的影响(执行效果)已经被保存。</p>
+
+<p>如果你想在每次用户导航到页面时都执行页面包含的scripts或者其他在页面加载期间执行的行为,或者你想知道什么时候用户导航至一个被缓存的页面,使用新的<code>pageshow</code> 事件.</p>
+
+<p>如果你拥有当用户导航离页面是执行的行为,但是你想利用这个新的缓存功能,因此不想使用unload处理程序,使用新的 <code>pagehide</code> 事件</p>
+
+<h3 id="pageshow_event" name="pageshow_event">pageshow 事件</h3>
+
+<p>这个事件和 <code>load</code> 事件一样的工作(效果), 除了它每次页面加载是都执行 that it fires every time the page is loaded (然而  <code>load</code> 事件在 Firefox 1.5中当页面从缓存中加载时不执行). 页面第一次加载时, <code>pageshow</code> 事件在 <code>load</code> 事件执行后执行。 <code>pageshow</code> 事件使用一个命名为<code>persisted</code> 的boolean属性,在初始加载时默认设置为 <code>false</code>。如果它不是初始加载,被设置为<code>true</code>(换句话说,但页面被缓存时它被设置为true).</p>
+
+<p>在 <code>pageshow</code> 事件执行时,设置每次页面加载时你想要运行的任何的JavaScript。</p>
+
+<p>如果你将JavaScript函数作为pageshow事件的一部分调用,你可以通过调用<code>pageshow</code> 事件作为<code>load</code>事件的一部分确保在不同于Firefox 1.5的浏览器在页面加载时调用这些函数,如在本文后面所示的示例。</p>
+
+<h3 id="pagehide_event" name="pagehide_event">pagehide 事件</h3>
+
+<p>如果你想定义当用户导航离页面时的行为,但是你不想使用 <code>unload</code>  (这将导致页面不被缓存),你可以使用新的  <code>pagehide</code> 事件。像 <code>pageshow</code> , <code>pagehide</code> 事件使用一个命名为<code>persisted</code> 的属性。 这个属性在页面未被浏览器缓存时设置为 <code>false</code>  ,如果页面被浏览器缓存则设置为 <code>true</code> 。如果这个属性被设置为 <code>false</code>, 如果有设置<code>unload</code> 处理程序的话,<code>unload</code> 事件在<code>pagehide</code> 事件执行后马上执行。</p>
+
+<p>当页面初次加载,Firefox 1.5 试图按事件会发生相同的顺序模拟load事件。Frames 被作为顶级文档一样对待。如果页面包含frames, 则当缓存当页面被加载:</p>
+
+<ul>
+ <li>每个frame的<code>pageshow</code> 事件在主文档的 <code>pageshow</code> 事件之前执行。</li>
+ <li>当用户导航离被缓存的页面, 每个frame的<code>pagehide</code> 事件在主文档的 <code>pagehide</code> 事件之前执行。</li>
+ <li>发生在一个 frame 的导航, 只有在受影响的frame触发事件。</li>
+</ul>
+
+<h2 id="示例代码">示例代码</h2>
+
+<p>以下的示例演示了一个页面同时使用 <code>load</code> 和 <code>pageshow</code> 事件。这个示例页面行为如下:</p>
+
+<ul>
+ <li>在除了Firefox 1.5的浏览器,以下在每次页面加载都发生:<code>load</code> 事件触发<code>onLoad</code> 函数,该函数调用 <code>onPageShow</code> 函数 (如同一个附加功能).</li>
+ <li>在Firefox 1.5,页面第一次加载时  <code>load</code> 事件和其他浏览器上运行一样。 除了, <code>pageshow</code> 事件的执行和 <code>persisted</code> 设置为 <code>false</code>,没有额外的行动发生。</li>
+ <li>在 Firefox 1.5, 当页面从缓存中被加载,只有 <code>pageshow</code> 事件执行。随着 <code>persisted</code> 被设置为 <code>true</code>,只有 <code>onPageShow</code> 方法中的JavaScript行为被触发。</li>
+</ul>
+
+<p>在这个例子中:</p>
+
+<ul>
+ <li>每次页面加载,页面计算并显示当前日期和时间。这个计算包括秒和毫秒,所以你可以很容易地测试功能。</li>
+ <li>第一次加载页面,光标放置在表单的Name字段。在 Firefox 1.5, 当用户导航回该页面,光标依然在页面导航离开时的位置。在其他浏览器,光标移回到Name字段。</li>
+</ul>
+
+<pre class="brush:html">&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd"&gt;
+&lt;HTML&gt;
+&lt;head&gt;
+&lt;title&gt;Order query Firefox 1.5 Example&lt;/title&gt;
+&lt;style type="text/css"&gt;
+body, p {
+ font-family: Verdana, sans-serif;
+ font-size: 12px;
+ }
+&lt;/style&gt;
+&lt;script type="text/javascript"&gt;
+function onLoad() {
+ loadOnlyFirst();
+ onPageShow();
+}
+
+function onPageShow() {
+//calculate current time
+ var currentTime= new Date();
+ var year=currentTime.getFullYear();
+ var month=currentTime.getMonth()+1;
+ var day=currentTime.getDate();
+ var hour=currentTime.getHours();
+ var min=currentTime.getMinutes();
+ var sec=currentTime.getSeconds();
+ var mil=currentTime.getMilliseconds();
+ var displayTime = (month + "/" + day + "/" + year + " " +
+ hour + ":" + min + ":" + sec + ":" + mil);
+ document.getElementById("timefield").value=displayTime;
+}
+
+function loadOnlyFirst() {
+ document.zipForm.name.focus();
+}
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload="onLoad();" onpageshow="if (event.persisted) onPageShow();"&gt;
+&lt;h2&gt;Order query&lt;/h2&gt;
+
+&lt;form name="zipForm" action="http://www.example.com/formresult.html" method="get"&gt;
+&lt;label for="timefield"&gt;Date and time:&lt;/label&gt;
+&lt;input type="text" id="timefield"&gt;&lt;br&gt;
+&lt;label for="name"&gt;Name:&lt;/label&gt;
+&lt;input type="text" id="name"&gt;&lt;br&gt;
+&lt;label for="address"&gt;Email address:&lt;/label&gt;
+&lt;input type="text" id="address"&gt;&lt;br&gt;
+&lt;label for="order"&gt;Order number:&lt;/label&gt;
+&lt;input type="text" id="order"&gt;&lt;br&gt;
+&lt;input type="submit" name="submit" value="Submit Query"&gt;
+&lt;/form&gt;
+&lt;/body&gt;
+&lt;/html&gt;
+</pre>
+
+<p>与此相反, 如果以上页面不监听 <code>pageshow</code> 事件,所有的计算作为 <code>load</code> 事件的一部分(取而代之的是如下面的示例代码片段所示的编码),Firefox 1.5 中,当用户导航离页面时,光标位置及date/time会被缓存。当用户返回回该页面,缓存的date/time将会显示。</p>
+
+<pre class="brush:html">&lt;script&gt;
+function onLoad() {
+ loadOnlyFirst();
+
+//calculate current time
+ var currentTime= new Date();
+ var year = currentTime.getFullYear();
+ var month = currentTime.getMonth()+1;
+ var day = currentTime.getDate();
+ var hour=currentTime.getHours();
+ var min=currentTime.getMinutes();
+ var sec=currentTime.getSeconds();
+ var mil=currentTime.getMilliseconds();
+ var displayTime = (month + "/" + day + "/" + year + " " +
+ hour + ":" + min + ":" + sec + ":" + mil);
+ document.getElementById("timefield").value=displayTime;
+}
+
+function loadOnlyFirst() {
+ document.zipForm.name.focus();
+}
+&lt;/script&gt;
+&lt;/head&gt;
+
+&lt;body onload="onLoad();"&gt;
+</pre>
+
+<h2 id="Developing_Firefox_extensions" name="Developing_Firefox_extensions">开发Firefox扩展</h2>
+
+<p>Firefox 1.5 <a href="/en-US/docs/Building_an_Extension" title="Building_an_Extension">extensions</a> 需要允许缓存功能。如果你在开发一个兼容1.5 及以前版本的Firefox扩展,确保它监听事件触发 <code>load</code> 可被缓存,监听的 <code>pageshow</code> 事件触发不应该被缓存。</p>
+
+<p>例如,Firefox的Google工具栏为了兼容1.5和更早的版本,应该为autolink监听 <code>load</code> 事件函数,为PageRank监听 <code>pageshow</code> 事件函数。</p>