[英]JS file not loading on IE, works on Chrome in Joomla Seblod
我在 Joomla Seblod 上添加了 JS 作为字段,它在我的文件系统my_profile.js中调用一个 JS 文件,如下所示 -
jQuery.getScript("/components/com_msp/js/my_profile.js")
.done(function(script, textStatus) {
console.log('inside success in seblod');
main();
}).fail(function( jqxhr, settings, exception ) {
console.log('JS failed in seblod..');
console.log(JSON.stringify(jqxhr));
console.log( "Error:" + settings + ' : ' + exception );
});
在 Chrome 上,JS 被正确调用并且所有代码都有效(我也在 Inspect 控制台上的inside success in seblod
),但在 IE 上,我在控制台上得到了这个 -
The code on this page disabled back and forward caching.
JS failed in seblod..
Error:parsererror : SyntaxError: Expected identifier
文件中的代码和一切都是一样的。 直到昨天我还可以看到 IE 上的变化。
parsererror: SyntaxError: Expected identifier
实际上导致 IE 上的 JS 代码出现问题。 我不得不逐行调试,最后在导致这种情况的代码中找到了 2 个实例-
我用它来循环一个对象for(const [serial, dates] of Object.entries(data)) {
。 必须用更简单的 for...in循环替换它 - for (var serial in data){ if (data.hasOwnProperty(serial)) {
我在我的脚本中使用了 sweetalert和一个 .then .then((result) => {
在里面,在一些挖掘中我发现 IE 不使用箭头操作符。所以我使用了一个关于 sweetalert 动作的queue
和基本上做了相同的步骤,但没有箭头操作符。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.