V.AISTUDIO / APPLY_EXCEL_FIX.md
bep40's picture
Upload APPLY_EXCEL_FIX.md
9357ad1 verified
|
Raw
History Blame
1.87 kB

Hướng dẫn áp dụng Fix Excel Download

Vấn đề

File Excel chỉ tải được 1 lần, lần 2+ thất bại vì URL.revokeObjectURL() được gọi sau 60s.

Cách 1: Thêm script (KHUYÊN DÙNG - NHANH NHẤT)

Mở file index.html, tìm thẻ </body>thêm đoạn sau vào ngay trước</body>>:

<!-- Excel Multi-Download Fix - Load AFTER qr-payment-v1038.js -->
<script>
(function(){
'use strict';
var excelBlobRegistry=[],isUnloading=!1;
function cleanupBlobs(){isUnloading=!0,excelBlobRegistry.forEach(function(e){try{URL.revokeObjectURL(e.url)}catch(err){}e.revoked=!0;}),excelBlobRegistry=[];}
window.addEventListener('pagehide',cleanupBlobs);
window.addEventListener('beforeunload',cleanupBlobs);
window.addEventListener('unload',cleanupBlobs);
(function(){var e=URL.revokeObjectURL;URL.revokeObjectURL=function(t){if(isUnloading||!t||"string"!=typeof t||!t.startsWith("blob:"))return e.call(this,t);if(!excelBlobRegistry.find(function(e){return e.url===t}))return void excelBlobRegistry.push({url:t,revoked:!1,created:Date.now()})}}})();
console.log('[Excel Multi-Download Fix] Loaded');
})();
</script>

Cách 2: Thêm script include

<script src="https://huggingface.co/spaces/bep40/V.AISTUDIO/resolve/main/excel-download-ultimate-fix-v2.js"></script>

Cách 3: Sửa trực tiếp trong qr-payment-v1038.js

Tìm và xóa 2 dòng sau:

  • Trong _doExportExcel: setTimeout(function(){URL.revokeObjectURL(url);},60000);
  • Trong _doExportDeliveryExcel: setTimeout(function(){URL.revokeObjectURL(url);},60000);

Test

  1. Mở Space V.AISTUDIO
  2. Tạo báo giá → Click 💾 Excel → tải
  3. Click 💾 Excel NGAY → vẫn tải được ✅

File đã chuẩn bị

  • excel-download-ultimate-fix-v2.js (đã upload)
  • PR #6 (đang chờ merge)

Cập nhật: 14-07-2026