Blazor 服务器在现代浏览器中显示空白页面

问题描述

我在 http://dev.softwaretechnik.it 运行一个 blazor 服务器网站

很遗憾,以下是最低浏览器版本要求。

  • Firefox 78 (2020-06-30 !!)(当前为 84)
  • Edge 80 (2020-02-07 !!)(当前为 87)
  • Opera 53 (2018-05-12 !)(当前为 71)
  • Chrome 66 (2018-04-17 !)(当前为 87)

旧版本只会显示一个空白页面。什么?!

会不会是 NET 5 的 css 隔离特性造成的?

编辑:见下面我的回答。

站点一个托管在 GitHub 上的开源社区项目。

_Host.cshtml:https://github.com/CleanCodeX/WebApp.SoE/blob/main/Pages/_Host.cshtml

Startup.cs:https://github.com/CleanCodeX/WebApp.SoE/blob/main/Startup.cs

其余的都非常标准。

任何线索这里出了什么问题?

解决方法

奇怪,虽然 firefox 77 无法加载 blazor.server.js,但下面的脚本说它支持一堆 ES6 特性。

Firefox 缺少什么阻止加载 Blazor 库的功能?

function HasEs6Support() {
    "use strict";

    if (typeof Symbol == "undefined") return false;
    try {
        // Arrow functions support
        () => {};

        // Class support
        class __ES6FeatureDetectionTest {
        };

        // Object initializer property and method shorthands
        let a = true;
        let b = {
            a,c() {
                return true;
            },d: [1,2,3],};

        // Object destructuring
        let { c,d } = b;

        // Spread operator
        let e = [...d,4];

        return true;
    } catch (e) {
        return false;
    }
}

此外,根据 https://kangax.github.io/compat-table/es6/

的特征列表

firefox 77 和 78 之间没有区别。但区别在于,78 可以正确加载页面,而 77 则不能。

我不知道为什么。