Hi all. I'm going to start by saying I am an extreme novice when it comes to code, especially Java. I have a client support screen that shows call statistics as well as SolarWinds maps. This isn't something I built, but something I basically walked into as I'm rather new to the company. Anyway, here's my issue.
The page needs refreshed throughout the day. I have determined that IE is eating up memory causing the page to stop functioning. Below is the code...
<html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "<head>
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script type="text/javascript">
var iframeSrc = new Array;
//iframeSrc[0] = "//iframeSrc[1] = "//iframeSrc[2] = "//iframeSrc[3] = "iframeSrc[0] = "iframeSrc[1] = "iframeSrc[2] = "iframeSrc[3] = "//Look into using NetworkMap.aspx instead of MapView.aspx...
var intervalVar;
var interval = 30; // seconds between iframe switching
var currentSrc = 0;
var lastPage = iframeSrc.length - 1;
var playing = false;
function switchPage() {
var randomnumber=Math.floor(Math.random()*100000);
$('#myIframe').fadeTo(1000,0,function() {
currentSrc++;
if (currentSrc > lastPage) currentSrc = 0;
document.getElementById("myIframe").src = iframeSrc[currentSrc] + "&random=" + randomnumber;
}).fadeTo(1000,1);
}
function slideshow() {
if (playing) {
playing = false;
clearInterval(intervalVar);
}
else {
playing = true;
intervalVar = setInterval(switchPage, interval * 1000);
}
}
function loadpage() {
document.getElementById("myIframe").src = iframeSrc[0];
slideshow();
}
</script>
<title>Support Page Viewer</title>
</head>
<body leftmargin="0" topmargin="0" onload="loadpage()">
<iframe id="myIframe" src="" width="75%" scrolling="NO" frameborder="0" height="75%" ></iframe>
<iframe id="callsframe" src=" width="25%" scrolling="NO" height="75%"></iframe>
<iframe id="agentsframe" src=" width="100%" height="25%" scrolling="no" marginheigh="0" marginwidth="0"></iframe>
</body>
</html>
Vacunita on another forum suggested that I do the following...
Wow, clearly nobody has bothered to actually read what the JS code is doing.
The Meta refresh isn't going to do anything useful in this scenario. The Js is not only refreshing the iframe, its also changing the src and the src URL by moving a counter along and adding a random parameter to it which I'm going to assume makes the src modify its contents in some fashion.
With that said, I think the option here would be to have the refresh kill the interval every so often to see if that releases memory.
CODE
var now = new Date();
var timeKeeper = now.getHour();
function switchPage() {
var now2 = new Date();
var newHour = now.getHour();
if(newHour > timekeeper)
{
playing=true;
slideshow();
timekeeper = newHour;
slideshow();
var randomnumber=Math.floor(Math.random()*100000);
...
This should kill off the interval running about every hour, hopefully release memory, and start it off again, as per the slideshow function.
Here's my issue. I have no idea where to put this in the code to make it work. My final question was asked where in the code to put this new code but I got no response. So I'm coming to the Java folks to see if they can help. I'm completely lost here and simply want to get this page working again. Vacunita's approach looks like it's going to work, I just don't know where to implement it. I greatly appreciate any help you can offer.
The page needs refreshed throughout the day. I have determined that IE is eating up memory causing the page to stop functioning. Below is the code...
<html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "<head>
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script type="text/javascript">
var iframeSrc = new Array;
//iframeSrc[0] = "//iframeSrc[1] = "//iframeSrc[2] = "//iframeSrc[3] = "iframeSrc[0] = "iframeSrc[1] = "iframeSrc[2] = "iframeSrc[3] = "//Look into using NetworkMap.aspx instead of MapView.aspx...
var intervalVar;
var interval = 30; // seconds between iframe switching
var currentSrc = 0;
var lastPage = iframeSrc.length - 1;
var playing = false;
function switchPage() {
var randomnumber=Math.floor(Math.random()*100000);
$('#myIframe').fadeTo(1000,0,function() {
currentSrc++;
if (currentSrc > lastPage) currentSrc = 0;
document.getElementById("myIframe").src = iframeSrc[currentSrc] + "&random=" + randomnumber;
}).fadeTo(1000,1);
}
function slideshow() {
if (playing) {
playing = false;
clearInterval(intervalVar);
}
else {
playing = true;
intervalVar = setInterval(switchPage, interval * 1000);
}
}
function loadpage() {
document.getElementById("myIframe").src = iframeSrc[0];
slideshow();
}
</script>
<title>Support Page Viewer</title>
</head>
<body leftmargin="0" topmargin="0" onload="loadpage()">
<iframe id="myIframe" src="" width="75%" scrolling="NO" frameborder="0" height="75%" ></iframe>
<iframe id="callsframe" src=" width="25%" scrolling="NO" height="75%"></iframe>
<iframe id="agentsframe" src=" width="100%" height="25%" scrolling="no" marginheigh="0" marginwidth="0"></iframe>
</body>
</html>
Vacunita on another forum suggested that I do the following...
Wow, clearly nobody has bothered to actually read what the JS code is doing.
The Meta refresh isn't going to do anything useful in this scenario. The Js is not only refreshing the iframe, its also changing the src and the src URL by moving a counter along and adding a random parameter to it which I'm going to assume makes the src modify its contents in some fashion.
With that said, I think the option here would be to have the refresh kill the interval every so often to see if that releases memory.
CODE
var now = new Date();
var timeKeeper = now.getHour();
function switchPage() {
var now2 = new Date();
var newHour = now.getHour();
if(newHour > timekeeper)
{
playing=true;
slideshow();
timekeeper = newHour;
slideshow();
var randomnumber=Math.floor(Math.random()*100000);
...
This should kill off the interval running about every hour, hopefully release memory, and start it off again, as per the slideshow function.
Here's my issue. I have no idea where to put this in the code to make it work. My final question was asked where in the code to put this new code but I got no response. So I'm coming to the Java folks to see if they can help. I'm completely lost here and simply want to get this page working again. Vacunita's approach looks like it's going to work, I just don't know where to implement it. I greatly appreciate any help you can offer.