Several modern browser security issues prevent raising a window to the top unless an actual user event occurs that focuses the popup window (i.e.: a button click is the only one that works and it cannot be synthesized).
You can try this code in the exec-js code page:
https://pgsoftwaretools.com/powerpac/assessments/exec-js/index.htmlvar loadWin = function(url, alignToName, refresh) {
var bds = { align : '', page : '', screen : '', titlebar : ''}, adj = 2, pos;
if (alignToName) {
bds.align = tbfunction_pgTBObjGet(alignToName, 'bounds').split(',');
}
bds.page = tbfunction_pgTBObjGet('page', 'bounds').split(',');
bds.screen = [window.screenX, window.screenY, window.outerHeight, window.innerHeight];
bds.titlebar = bds.screen[2] - bds.screen[3];
pos = [ bds.align[0]*1 + bds.page[0]*1 + bds.screen[0]-adj,
bds.align[1]*1 + bds.page[1]*1 + bds.screen[1] + bds.titlebar-adj*2,
bds.align[2], bds.align[3] - Math.round(bds.titlebar/2.65)*2 ];
/* Next line gives trouble in Chrome if "RefWindow" does not exist.
Only set refresh to true for 2nd execution.
This will be addressed in PowerPac v15 beta.
***/
if (refresh) window.open('', 'RefWindow').close();
return tbfunction_pgGotoURL("RefWindow", url, pos[0], pos[1], pos[2], pos[3], "",
"scrollbars=1", true, true);
};
var frm = getToolBookFrame();
frm.myWindow = loadWin('https://google.com', 'exec', false);
frm.myWindow.focus();
pgAddEvent(gTBo('returnVal', 'objRef'), 'click', function() {
frm.myWindow.focus();
});
return 'click this field to move popup to top';
Any attempt to accomplish this with a timer has not been successful. Frankly, if browser focus could be used in a timer would give hackers and other malicious coders a lot of leverage. So I agree with the browser limitation here. However, if clicking an object immediately raises the popup, it would seem that this could still be useful to you.
NOTE: A bug fix in
pgGotoURL() will require you to run this code using a page with the PowerPac v14.936.x.