瀏覽器相容性
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
建立內容導向網頁應用程式時,請務必考量目標對象使用的瀏覽器。某些瀏覽器可能不支援最新功能,而有些則使用不支援最新功能的舊版瀏覽器。無論使用者選擇哪個瀏覽器,所有使用者都能存取您的應用程式。
請使用漸進式強化功能,或從所有瀏覽器支援最基本的功能開始,接著為較新的瀏覽器新增其他功能。功能偵測是另一種觸及使用日期版本或新瀏覽器使用者的策略。您可以使用功能偵測功能,判斷使用者瀏覽器支援哪些功能,然後載入適當的程式碼。您的應用程式應使用使用者瀏覽器可支援的最新功能。
指定新舊瀏覽器時,需要考量一些缺點。首先,您可能需要針對各種瀏覽器使用不同的程式碼。這可能會導致程式碼更複雜且難以維護。你可能無法在所有瀏覽器中使用最新功能。這可能會限制應用程式功能。
視應用程式而定,基於法律原因或業務用途,舊版瀏覽器可能仍需要支援。如果大部分使用者使用的是舊版硬體,無法更新,則可能需要使用 polyfill。polyfill 為舊版網路瀏覽器提供新型功能,可讓您使用最新型的網頁技術和 API,同時確保與舊版瀏覽器相容。
我們提供許多實用工具,方便您查看目前使用的技術或 API:
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[null,null,["上次更新時間:2025-07-25 (世界標準時間)。"],[[["\u003cp\u003eWeb applications should be accessible to all users regardless of their browser choice, potentially using progressive enhancement or feature detection to cater to different browser capabilities.\u003c/p\u003e\n"],["\u003cp\u003eWhile supporting older browsers might necessitate using different code or limit access to the latest features, it can be crucial for legal compliance or business needs, especially when users rely on older hardware.\u003c/p\u003e\n"],["\u003cp\u003ePolyfills can bridge the gap between modern web technologies and older browsers, ensuring compatibility while enabling the use of the latest features.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can utilize tools like Project Baseline and Caniuse to determine browser compatibility and make informed decisions about web development strategies.\u003c/p\u003e\n"]]],["When creating web applications, consider browser compatibility. Employ progressive enhancement by starting with basic features and adding advanced ones for newer browsers. Use feature detection to load appropriate code based on browser capabilities. Supporting both old and new browsers may increase code complexity and limit functionality. Polyfills can bridge the gap by adding modern capabilities to older browsers. Tools like Project Baseline and Caniuse help determine browser support for various technologies.\n"],null,["# Browser compatibility\n\nWhen building a content driven web application, it is important to consider\nwhich browsers your audience is using. Some might use older browsers that don't\nsupport the latest features, while others may be using newer browsers that have\nmore features. Your application is accessible to all users, regardless of their\nbrowser choice.\n\nUtilize progressive enhancement, or start with the most basic features that all\nbrowsers support, and then add additional features for newer browsers. Feature\ndetection is another strategy to reach users with dated or new browsers. With\nfeature detection, you can determine which features are supported by the user's\nbrowser, and then you load the appropriate code. Your application should use the\nmost up-to-date features that the user's browser can support.\n\nThere are a few tradeoffs to consider when targeting both old and modern\nbrowsers. First, you may need to use different code for various browsers. This\ncan make your code more complex and difficult to maintain. You might not be\nable\\\u003e to use the latest features in all browsers. This can limit the\nfunctionality of your application.\n\nDepending on the application, older browsers may still need support for legal\nreasons or business use cases. If the majority of the users are on older\nhardware and cannot update, then polyfills may be necessary. A polyfill provides\nmodern capabilities to older web browsers and can allow you to use the most\nmodern web technologies and APIs while still ensuring compatibility with old\nbrowsers.\n\nThere are many great tools to check what technologies or APIs are used:\n\n- [Project Baseline](https://web.dev/baseline/): is an effort to improve the experience of developers by providing what works well in supported browsers and is backed by Google and other commonly used systems.\n- [Caniuse](https://caniuse.com/): is a resource to look up Web APIs and see the support status across all tracked browsers."]]