¥Browser Support
Remix 仅在支持 ES 模块 的浏览器中运行。
¥Remix only runs in browsers that support ES Modules.
通常,团队在提出这个问题时会担心 IE11 的支持情况。请注意,微软本身已停止支持此浏览器 适用于他们的 Web 应用,你可能也应该这样做。
¥Usually teams are concerned about IE11 support when asking this question. Note that Microsoft itself has stopped supporting this browser for their web applications, and it's probably time for you, too.
但是,由于对 渐进式增强 的一级支持,Remix 应用可以支持 Netscape 1.0 等老版本的浏览器!这之所以行得通,是因为 Remix 建立在 Web 基础之上:HTML、HTTP 和浏览器行为。通过遵循 Remix 约定,你的应用可以在 IE11 的基准级别上运行,同时仍然为现代浏览器提供高度交互的 SPA 体验。你也不需要花费太多精力来实现这一点。
¥However, thanks to first-class support for Progressive Enhancement, Remix apps can support browsers as old as Netscape 1.0! This works because Remix is built on the foundations of the web: HTML, HTTP, and browser behavior. By following Remix conventions, your app can work at a baseline level for IE11, while still providing a highly interactive SPA experience for modern browsers. It doesn't take much effort on your part to achieve this, either.
它的工作原理如下。Remix <Scripts/>
组件渲染模块脚本标签如下:
¥Here's how it works. The Remix <Scripts/>
component renders module script tags like this:
<script type="module" src="..." />
旧版浏览器会忽略它,因为它们不理解 type
,因此不会加载任何 JavaScript。链接、加载器、表单和操作仍然有效,因为它们建立在 HTML、HTTP 和浏览器行为的基础之上。现代浏览器会加载这些脚本,从而提供增强的 SPA 行为、更快的转换速度和增强的应用代码用户体验。
¥Older browsers ignore it because they don't understand the type
, so no JavaScript is loaded. Links, loaders, forms, and actions still work because they are built on the foundations of HTML, HTTP, and browser behavior. Modern browsers will load the scripts, providing enhanced SPA behavior with faster transitions and the enhanced UX of your application code.
¥Does Remix implement CSRF protection?
Remix 的 Cookie 默认配置为 SameSite=Lax
,这是平台内置的 CSRF 保护机制。如果你需要支持不支持 SameSite=Lax
的旧版浏览器(IE11 或更早版本),则必须自行实现 CSRF 保护或使用实现该保护机制的库。
¥Remix cookies are configured to SameSite=Lax
by default which is platform built-in protection against CSRF, if you need to support old browsers (IE11 or older) that doesn't support SameSite=Lax
you would have to implement CSRF protection yourself or use a library that implements it.