以下代码的作用是从父网页接受字段值,须加在
// Make sure the message comes from a trusted source
const allowedOrigins = [window.location.origin];
if (!allowedOrigins.includes(event.origin)) {
return;
}
try {
// Attempt to parse the received JSON data
const data = JSON.parse(event.data);
// Check if the received data contains a username and password
if (data && data.username && data.password) {
// Update input fields with the received values
document.getElementById("input_104").value = data.nom;
document.getElementById("input_105").value = data.rol;
}
} catch (error) {
// Handle any parsing errors
console.error("Error parsing received
});