Hello folks
Here i share a problem I have encountered today, as I tried to develop something that I was asked.
First, I will state what I want to accomplish, what I did and what works and what doesn’t.
I was asked to show on a screen 2 webpages, and they have to be alternated in a 40s/20s fashion.
URL 1 40s and followed by URL2 20 sec and so on.
I created a setup using the browser package , Then I created 2 webservers, each one with a URL.
Apart, i created a javascript that runs generating the “resulted” URL in which the 2 URLs are switched.
here is the code
var urls = ["URL1.html", "URL2html"];
var index = 0;
function switchUrl() {
document.getElementById("iframe").src = urls[index];
index = (index + 1) % urls.length;
// Set the interval for the next switch
var interval = (index == 0) ? 9000 : 3500;
setTimeout(switchUrl, interval);
}
// Start with the first URL
document.getElementById("iframe").src = urls[0];
// Set the initial interval
setTimeout(switchUrl, 25000);
The “resulted” URL has this code
<!DOCTYPE html>
<html>
<head>
<title>URL Switcher</title>
<script>
function switchURL() {
var url1 = "URL1.html/";
var url2 = "URL2.html/";
var currentURL = document.getElementById("myFrame").src;
if (currentURL == url1) {
document.getElementById("myFrame").src = url2;
} else {
document.getElementById("myFrame").src = url1;
}
setTimeout(switchURL, 6000); // switch every 5 seconds
}
</script>
</head>
<body onload="switchURL()">
<iframe id="myFrame" src="mywebsite/"></iframe>
</body>
</html>
Now, if I copy&paste the “resulted” URL which points to that webpage, into a local browser on my machine, the browser displays correctly both webpages switching between the two in an endless loop. That is the desired result.
However, when I put the same URL in the browser setup I created earlier and assign that setup to a player, it will display URL1 and a blank webpage for the URL2.
What I tried:
created a diferrent webserver, same result
rebooted the device, nothing
created a new setup from scratch , but same thing happens.
created a different browser for each URL , trying to display just the simple URL, just only one works.
created yet another browser setup where i put different URL, all are working
I am bafled and a bit lost
What I am missing?