` Printed Icetips Article

Icetips Article



Par2: Browser exit instead of timeout
2000-09-05 -- Michael Boston
 
I have examples that do about what you want to do.
It includes a timeout function so that if the page is not changed for nn
minutes the browser page auto submits an exit to terminate application
program and closes the browser window.
In the first sample the timeout is 10 minutes.
If the browser window has an opener object (it was opened by another browser
window) then you can close it with JavaScript.
Generally my examples start in their own window and then close that window
on exit.  This is done by including a small script in the onBodyUnload
function like so:
    if (form.__Special__.value == "EXIT=1") {
      window.close();
    }
And the statement:
var timerID=setTimeout("autoExit()",600000);
And the function:
function autoExit(){
icSubmit("EXIT=1")
  }

Then I make sure my Program Exit button's use Variable in the IDE is ?Exit.
Thus when the Exit button is submitted for a program exit, the Browser
Window closes as the page is unloaded prior to loading the dreaded Clarion
Blue Screen or whatever is in page to return to. Thus the Clarion blue
screen is never seen and the Client is returned to the original screen that
the link was on.
I have set up program logic so that a user can Exit from any level of the
program with an "Exit Now" button -- which does a complete program exit and
closes the browser window.
The new application window.open is different for Netscape and IE if you want
to control the window size and placement.
The samples are at http://207.168.85.50/samples.htm  .
Feel free to copy whatever you need via view source.



Printed November 23, 2024, 10:20 pm
This article has been viewed/printed 35214 times.