1. The custom event triggers the click event of .cpcstartrefresh, but triggers 2 click events each time
2. The code is as follows:
window.onmessage = function (e) {
/ / create an event object,
var myEvent = document.createEvent("Event");
myEvent.initEvent("click", false, false);
e = e || event;
e.eventType = "message";
if (e.data === "returnfromsht") {
console.log(e.data, "returnfromsht4");
//2
document.getElementsByClassName("cpcstartrefresh")[0].dispatchEvent(myEvent);
} else if (e.data === "maximumwindow") {
console.log(e.data, "maximumwindow");
}
};