diff --git a/content.js b/content.js index 926b302..d3429bf 100644 --- a/content.js +++ b/content.js @@ -156,13 +156,18 @@ if (!included.length) throw new Error('No enrolled courses found.'); const totalUnits = ISMIStools.sumUnits(included); const html = ISMIStools.buildStudyLoadHtml({ header, courses: included, totalUnits }); - const win = window.open('', '_blank'); + const blob = new Blob([html], { type: 'text/html' }); + const url = URL.createObjectURL(blob); + const win = window.open(url, '_blank'); if (!win) { + URL.revokeObjectURL(url); showToast('Popup blocked — allow popups for this site, then try again.', true); return; } - win.document.write(html); - win.document.close(); + // The blob document runs its own onload → window.print(). Never touch + // win.document here: if the new tab navigates cross-origin, accessing it + // throws "Permission denied". + setTimeout(() => URL.revokeObjectURL(url), 60000); showToast('Opened printable Study Load.'); } catch (err) { showToast('Error: ' + ((err && err.message) || err), true);