I have 6 monitors and one host. I used a multi-screen segmentation to display 6 dashboards. Each dashboard is set to auto refresh.I am using the latest version of google chrome.When I adjust the scrollbar position of each dashboard, the user can see more charts. But when the browser is refreshed, the scroll bar will automatically jump to the top, which makes the chart at the bottom of the browser invisible. How can I solve this problem?I think I can use javascript to solve the issue, I found a js code that needs to add some elements to the body, but it seems that I can't control any elements inside the body tag.
function showInfo(type,code){
window.location.href = "__URL__/show"+type+"/id/"+code;
}
function Trim(strValue)
{
return strValue.replace(/^s*|s*$/g,"");
}
function SetCookie(sName,sValue)
{
document.cookie = sName + "=" + escape(sValue);
}
function GetCookie(sName)
{
var aCookie = document.cookie.split(";");
for(var i=0; i < aCookie.length; i++)
{
var aCrumb = aCookie[i].split("=");
if(sName == Trim(aCrumb[0]))
{
return unescape(aCrumb[1]);
}
}
return null;
}
function scrollback()
{
if(GetCookie("scroll")!=null){document.body.scrollTop=GetCookie("scroll")}
}
also need to modify the body:
<body id=body onscroll=SetCookie("scroll",body.scrollTop); onload="scrollback();">
In the end, I solved this problem, which looks like a browser bug.When I installed two extensions in the google chrome , I found that when I refreshed the dashboard.the scrollbars were no longer reset.When I remove the extension from google chrome, the scrollbar will be reset to the top when the dashboard is refreshed.This seems like a very strange question.I don't know if you have encountered the same problem.So I no longer need js to control the scroll bar here.
In the end, I solved this problem, which looks like a browser bug.When I installed two extensions in the google chrome , I found that when I refreshed the dashboard.the scrollbars were no longer reset.When I remove the extension from google chrome, the scrollbar will be reset to the top when the dashboard is refreshed.This seems like a very strange question.I don't know if you have encountered the same problem.So I no longer need js to control the scroll bar here.