DataTables jQuery 插件 - Firefox 声明 "illegal character"

DataTables jQuery Plugin - Firefox claims "illegal character"

得到这样的东西:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <script type="text/javascript" src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
    <script type="text/javascript" src="https://cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js"></script>
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.13/css/jquery.dataTables.min.css">
    <script>
    $(document).ready(function() {
        $("#myTable").dataTable({
            "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
            "iDisplayLength": 25,
            "order": []
        });
    });
    </script>
    <style>
    th,
    td {
        white-space: nowrap
    }

    TD+TD+TD+TD+TD+TD {
        color: white
    }
    </style>
</head>

<body>
    <table id="myTable" class="display" cellspacing="0" width="100%"> .... </table>
</body>

</html>

这在 Internet Explorer 11 中工作正常。 Firefox 52 不会加载 DataTables 插件并声明 SyntaxError: illegal character 从 CDN 加载的 jquery.dataTables.min.js 的第一个字符。 也试过保存js文件在本地加载,还是一样。 这是怎么回事?

感谢帮助!

编辑:

所以我下载了DataTablesCSS和JS文件并用编码UTF-8 with BOM重新保存了它们。他们之前被保存为UTF-8(没有BOM)。现在它正在工作。这是 Firefox 中的错误吗?我怎样才能避免这种情况?

通过以下方式解决此问题:

 <script type="text/javascript" src="https://cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js" charset="utf-8"></script>
 <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.13/css/jquery.dataTables.min.css" charset="utf-8">