IFrame met Dynamic Path
var stocklistData = getStocklistData();
if (stocklistData && stocklistData.licenseElement) {
// Element found, get the dynamic value from the text of the element
var dynamicPath = stocklistData.licenseElement.innerText.trim();
// Combine the fixed URL and the dynamic path to get the full iframe URL
var iframeURL = fixedURL + dynamicPath;
// Create a new iframe element
var iframe = document.createElement('iframe');
iframe.src = iframeURL;
iframe.width = "100%";
iframe.height = "500px";
// Append the iframe to the body
document.body.appendChild(iframe);
} else {
// Element not found, perform another action or log a message
console.log("Element with class 'license_nl' not found in the database.");
}
}
// Simulate retrieving data from the database of
function getStocklistData() {
// Simulate fetching data from the server or using some client-side storage
// In this example, I'm using a dummy dataset
return {
licenseElement: document.querySelector("div.license_nl")
};
}
// Call the function when the page is loaded
checkPageAndDisplayIframe();
×
Hallo!
Klik op het onderstaande contact om een chat via Whatsapp te starten.