WA Forums
Latest version of Chrome throwing errors for PVii js files - Printable Version

+- WA Forums (https://webassist-pro.com/WAforum)
+-- Forum: Introduction (https://webassist-pro.com/WAforum/forumdisplay.php?fid=1)
+--- Forum: Project Seven (https://webassist-pro.com/WAforum/forumdisplay.php?fid=10)
+--- Thread: Latest version of Chrome throwing errors for PVii js files (/showthread.php?tid=31)



Latest version of Chrome throwing errors for PVii js files - I-CRE8 - 02-07-2025

The latest version of Chrome has deprecated the unload event, see https://developer.chrome.com/docs/web-platform/deprecating-unload, this is causing issues with a lot of PVII's scripts. In my case on the site I am working on both AMM and MBX are affected.

The fix is to change the unload event to before unload like so:

Code:
function P7_MBXaddLoad(){
var ie = P7_MBXgetIEver();
if (!document.getElementById || (ie > 0 && ie < 6)) {
return;
}
if (window.addEventListener) {
document.addEventListener("DOMContentLoaded", P7_MBXinit, false);
window.addEventListener("load", P7_MBXinit, false);
//window.addEventListener("unload", P7_MBXbb, false);
window.addEventListener("beforeunload", P7_MBXbb, false); // Changed from unload to beforeunload
document.addEventListener("keydown", P7_MBXkey, false);
window.addEventListener("resize", P7_MBXrsz, false);
} else if (window.attachEvent) {
document.write("<script id=p7ie_mbx defer src=\"//:\"><\/script>");
document.getElementById("p7ie_mbx").onreadystatechange = function(){
if (this.readyState == "complete") {
if (p7MBX.ctl.length > 0) {
P7_MBXinit();
}
}
};
window.attachEvent("onload", P7_MBXinit);
window.attachEvent("onunload", P7_MBXbb);
document.attachEvent("onkeydown", P7_MBXkey);
window.attachEvent("onresize", P7_MBXrsz);
}
}


Hope that helps


RE: Latest version of Chrome throwing errors for PVii js files - bizpat (Patrice) - 02-09-2025

Thank you! I will go through all of my sites this week to make the change, since they ALL use AMM. 

Most appreciated!