<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Browser on Ricky</title><link>https://linzeyan.github.io/zh-tw/categories/browser/</link><description>Recent content in Browser on Ricky</description><generator>Hugo -- gohugo.io</generator><language>zh-tw</language><lastBuildDate>Mon, 29 Sep 2025 16:41:00 +0800</lastBuildDate><atom:link href="https://linzeyan.github.io/zh-tw/categories/browser/index.xml" rel="self" type="application/rss+xml"/><item><title>Privacy Badger：EFF 推出的免費瀏覽器擴充套件，用來阻止網路監控追蹤</title><link>https://linzeyan.github.io/zh-tw/posts/2025/20250929-eff-browser-extension/</link><pubDate>Mon, 29 Sep 2025 16:41:00 +0800</pubDate><guid>https://linzeyan.github.io/zh-tw/posts/2025/20250929-eff-browser-extension/</guid><description>&lt;ul>
&lt;li>&lt;a href="https://privacybadger.org/" target="_blank" rel="noopener">Privacy Badger：EFF 推出的免費瀏覽器擴充套件，用來阻止網路監控追蹤&lt;/a>&lt;/li>
&lt;/ul></description></item><item><title>比 Ctrl+F 更聰明：直接連到網頁內容</title><link>https://linzeyan.github.io/zh-tw/posts/2024/20241225-linking-directly-to-web-page-content/</link><pubDate>Wed, 25 Dec 2024 08:45:00 +0800</pubDate><guid>https://linzeyan.github.io/zh-tw/posts/2024/20241225-linking-directly-to-web-page-content/</guid><description>&lt;ul>
&lt;li>&lt;a href="https://alfy.blog/2024/10/19/linking-directly-to-web-page-content.html" target="_blank" rel="noopener">比 Ctrl+F 更聰明：直接連到網頁內容&lt;/a>&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>語法&lt;/strong>&lt;/p>
&lt;p>&lt;code>https://example.com/page.html#:~:text=[prefix-,]textStart[,textEnd][,-suffix]&lt;/code>&lt;/p>
&lt;p>&lt;strong>範例&lt;/strong>&lt;/p>
&lt;p>&lt;code>https://developer.mozilla.org/en-US/docs/Web/URI/Fragment/Text_fragments#:~:text=without%20relying%20on%20the%20presence%20of%20IDs&lt;/code>&lt;/p></description></item><item><title>LocalStorage vs. IndexedDB vs. Cookies vs. OPFS vs. WASM-SQLite</title><link>https://linzeyan.github.io/zh-tw/posts/2024/20241129-localstorage-indexeddb-cookies-opfs-sqlite-wasm/</link><pubDate>Fri, 29 Nov 2024 14:58:29 +0800</pubDate><guid>https://linzeyan.github.io/zh-tw/posts/2024/20241129-localstorage-indexeddb-cookies-opfs-sqlite-wasm/</guid><description>&lt;ul>
&lt;li>&lt;a href="https://rxdb.info/articles/localstorage-indexeddb-cookies-opfs-sqlite-wasm.html" target="_blank" rel="noopener">LocalStorage vs. IndexedDB vs. Cookies vs. OPFS vs. WASM-SQLite&lt;/a>&lt;/li>
&lt;/ul>
&lt;h4 id="現代瀏覽器可用的-storage-api">現代瀏覽器可用的 Storage API&lt;/h4>
&lt;p>&lt;strong>&lt;em>Cookies&lt;/em>&lt;/strong>&lt;/p>
&lt;p>Cookies 會儲存小型的鍵值資料，主要用於工作階段管理、個人化與追蹤。Cookies 可以設定多種安全選項，例如存活時間或網域屬性，以便在多個子網域之間共用。&lt;/p>
&lt;p>&lt;strong>&lt;em>LocalStorage&lt;/em>&lt;/strong>&lt;/p>
&lt;p>LocalStorage 只適合儲存少量且需要跨 session 保存的資料，並且受限於 5MB 的容量上限。要儲存複雜資料，通常需要轉成字串，例如使用 JSON.stringify()。這個 API 不是非同步的，代表在操作時會阻塞你的 JavaScript 程序，因此執行重型操作可能會讓 UI 無法渲染。&lt;/p>
&lt;p>&lt;strong>&lt;em>IndexedDB&lt;/em>&lt;/strong>&lt;/p>
&lt;p>IndexedDB 是一個用於儲存大量結構化 JSON 資料的低階 API。雖然使用起來有些困難，但 IndexedDB 可以利用索引並支援非同步操作。它缺乏複雜查詢能力，只能迭代索引，更像是其他函式庫的底層基礎，而非完整的資料庫。&lt;/p>
&lt;h4 id="儲存容量限制">儲存容量限制&lt;/h4>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>技術&lt;/th>
&lt;th>上限&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>Cookie&lt;/td>
&lt;td>4 KB&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>LocalStorage&lt;/td>
&lt;td>每個來源 4 MB 到 10 MB&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>IndexedDB&lt;/td>
&lt;td>取決於瀏覽器實作&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>OPFS&lt;/td>
&lt;td>取決於可用的磁碟空間&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;h4 id="效能比較">效能比較&lt;/h4>
&lt;h5 id="初始化時間">初始化時間&lt;/h5>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>技術&lt;/th>
&lt;th>時間（毫秒）&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>IndexedDB&lt;/td>
&lt;td>46&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>OPFS 主執行緒&lt;/td>
&lt;td>23&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>OPFS WebWorker&lt;/td>
&lt;td>26.8&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>WASM SQLite（記憶體）&lt;/td>
&lt;td>504&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>WASM SQLite（IndexedDB）&lt;/td>
&lt;td>535&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;h5 id="小型寫入延遲">小型寫入延遲&lt;/h5>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>技術&lt;/th>
&lt;th>時間（毫秒）&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>Cookies&lt;/td>
&lt;td>0.058&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>LocalStorage&lt;/td>
&lt;td>0.017&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>IndexedDB&lt;/td>
&lt;td>0.17&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>OPFS 主執行緒&lt;/td>
&lt;td>1.46&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>OPFS WebWorker&lt;/td>
&lt;td>1.54&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>WASM SQLite（記憶體）&lt;/td>
&lt;td>0.17&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>WASM SQLite（IndexedDB）&lt;/td>
&lt;td>3.17&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;h5 id="小型讀取延遲">小型讀取延遲&lt;/h5>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>技術&lt;/th>
&lt;th>時間（毫秒）&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>Cookies&lt;/td>
&lt;td>0.132&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>LocalStorage&lt;/td>
&lt;td>0.0052&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>IndexedDB&lt;/td>
&lt;td>0.1&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>OPFS 主執行緒&lt;/td>
&lt;td>1.28&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>OPFS WebWorker&lt;/td>
&lt;td>1.41&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>WASM SQLite（記憶體）&lt;/td>
&lt;td>0.45&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>WASM SQLite（IndexedDB）&lt;/td>
&lt;td>2.93&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table></description></item><item><title>在瀏覽器輸入網址並送出後，到底發生了什麼事？</title><link>https://linzeyan.github.io/zh-tw/posts/2021/20210718-what-happens-when-you-type-an-url-in-the-browser-and-press-enter/</link><pubDate>Sun, 18 Jul 2021 23:45:45 +0800</pubDate><guid>https://linzeyan.github.io/zh-tw/posts/2021/20210718-what-happens-when-you-type-an-url-in-the-browser-and-press-enter/</guid><description>&lt;ul>
&lt;li>&lt;a href="https://www.cythilya.tw/2018/11/26/what-happens-when-you-type-an-url-in-the-browser-and-press-enter/" target="_blank" rel="noopener">在瀏覽器輸入網址並送出後，到底發生了什麼事？&lt;/a>&lt;/li>
&lt;/ul></description></item><item><title>為什麼瀏覽器 user-agent string 總是包含 Mozilla/5.0 ?</title><link>https://linzeyan.github.io/zh-tw/posts/2018/20181017-mozilla5-0-always-user-agent-string/</link><pubDate>Wed, 17 Oct 2018 12:03:04 +0800</pubDate><guid>https://linzeyan.github.io/zh-tw/posts/2018/20181017-mozilla5-0-always-user-agent-string/</guid><description>&lt;ul>
&lt;li>&lt;a href="https://yulun.me/2013/mozilla5-0-always-user-agent-string/" target="_blank" rel="noopener">為什麼瀏覽器 user-agent string 總是包含 Mozilla/5.0 ?&lt;/a>&lt;/li>
&lt;li>&lt;a href="http://stackoverflow.com/questions/12288452/what-does-mozilla-5-0-in-user-agent-string-signify" target="_blank" rel="noopener">What does &amp;ldquo;Mozilla/5.0&amp;rdquo; in user agent string signify?&lt;/a>&lt;/li>
&lt;li>&lt;a href="http://webaim.org/blog/user-agent-string-history/" target="_blank" rel="noopener">History of the browser user-agent string&lt;/a>&lt;/li>
&lt;/ul>
&lt;p>快速結論&lt;/p>
&lt;p>因為網站開發者可能會因為你是某瀏覽器(這裡是 Mozilla)，所以輸出一些特殊功能的程式碼(這裡指好的特殊功能)，所以當其他瀏覽器也支援這種好功能時，就試圖去模仿 Mozilla 瀏覽器讓網站輸出跟 Mozilla 一樣的內容，而不是輸出被閹割功能的程式碼。&lt;/p></description></item></channel></rss>