Within the browser settings in the SystemWebConfig under RunJsScript web pages can be modified after successful loading.
The JavaScript code in the RunOnLoadSuccess editor is executed automatically.
Examples
Preventing dynamic window size for HTML5 visualization Saia controls
JavaScript
function setStaticWindow()
{
if (document.getElementById("rt") != null)
{
var sWidth = window.innerWidth + "px";
var sHeight = window.innerHeight + "px";
if (document.getElementById("rt").style.width != sWidth && document.getElementById("rt").style.height != sHeight)
{
document.getElementById("rt").style.width = sWidth;
document.getElementById("rt").style.height = sHeight;
//alert("setStaticWindow: " + sWidth + "/" + sHeight);
}
}
else
{
setTimeout(function(){ setStaticWindow(); }, 100);
}
}
setStaticWindow();
Scroll the focused element into the visible area of the browser, if virtual keyboard hides the element
JavaScript
var actMousePosY = 0;
var docHeight = window.innerHeight;
function scrollToOffset(e)
{
var scrollPosTop = 0;
if (actMousePosY > docHeight/2)
{
scrollPosTop = docHeight/2;
}
console.log("scrollToOffset: docHeight:" + docHeight + ", actMousePosY:" + actMousePosY + ", scrollPosTop=>" + scrollPosTop);
window.scrollTo(0, scrollPosTop - 50);
}
function scrollToVisibleView(e)
{
var e = window.e || e;
setTimeout(function(){ scrollToOffset(e.target); }, 100);
}
document.addEventListener('focusin', scrollToVisibleView, false);
document.onmousemove = function(e){actMousePosY = e.clientY; }