How to configure the session expiring time in KTML 4

KTML 4 operates mostly on the client-side, without any need for a remote server. But its use as an enhancement for a web site form makes it depend on a remote server, and the way it handles its visitors. When logging in into a site's back-end or front-end to edit some content with KTML, you no longer refresh the page for a longer period of time - the time it takes to edit a large content. Due to inactivity, some servers delete the user session, and when you complete editing the content and submit your work, instead of saving it safely on the server, an error message that you are not logged in or the session expired is displayed.

To prevent this, KTML uses a keep alive mechanism which prevents the session from expiring. Basically, it sends small requests to the server so that it sees some activity and prolong the session life. By default, the refresh interval - or the session expiring time - is of 20 minutes. If your server deletes a session faster than this you might consider changing the time.

To change the session expiration time for a KTML control - it is done independently on each one - follow the next steps:

  1. Open the page that contains the KTML control.

  2. Locate the line that creates a new instance of the control. It should resemble this:

    <script>
    ktml_ktml1 = new ktml("ktml1");
    </script>
     

  3. Add a new <script> section right after the one above. It should contain the following lines, where you define the time in seconds. The example below sets the session expiration time to 5 minutes:

    <script>
       //seconds between session keepalive requests
       ktml_init_object.session_keepalive = 5 * 60;
    </script>

     

  4. Save the page. The changes are loaded when the KTML editor window is created.

 

If you cannot change this setting, and have a large content to edit, make sure you copy the content to an offline editor right before hitting the submit button, so that you will not lose any of your work.