[英]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.