Reputation: 318
Got something like this:
<!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>
This works fine in Internet Explorer 11
. Firefox 52
won't load the DataTables Plugin and claims SyntaxError: illegal character
on the first character of jquery.dataTables.min.js
loaded from the CDN.
Also tried to save the js file and load it locally, still the same.
What's going on here?
Thanks for help!
EDIT:
So I downloaded the DataTables CSS and JS file and resaved them with encoding UTF-8 with BOM
. They were saved as UTF-8
(without BOM) before. Now it's working. Is this a bug in Firefox? How can I avoid this?
Upvotes: 1
Views: 480
Reputation: 318
Resolved this with:
<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">
Upvotes: 1