Focal Point
[CLOSED] Browser "Back Arrow" Button Disconnects WebFocus Maintain Application

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/219101532

September 10, 2009, 09:26 AM
KentO
[CLOSED] Browser "Back Arrow" Button Disconnects WebFocus Maintain Application
I am using WebFocus Maintain Forms for users to enter data and look-up information. I do not use dashboard.
Some users, out of habit, click the browser "Back Arrow" button when they want to go back to the previous form. This disconnects them from the server and forces them to reconnect by starting a new WebFocus session.
Has anyone come up with a way to get around the disconnect when a user clicks the "Back Arrow" button?
Thanks, Kent

This message has been edited. Last edited by: Kerry,


Windows2003 Server, WebFOCUS 7.7.02 Developers Studio and MRE
September 10, 2009, 10:14 AM
Maintain Wizard
Kent
The reason for the disconnect is because the application has a persistant connection to the server. If the user clicks on the arrows the application will disconnect. We have found that the only way to truly stop the user from clicking on the arrows is not to display them.

You can launch Maintain in window without the toolbars. Here is an example of the code to do that. Create an HTML Launch page or add this code to your existing page.

Mark

  
<html>
<body onload="launchMaintainProc();">
<script language="JavaScript">
function launchMaintainProc()
{
var getRandomNum = Math.random();
var launchURL = "/ibi_apps/WFServlet?IBIS_connect=on&IBIAPP_APP=ibisamp";
    launchURL = launchURL + "&IBIC_server=EDASERVE&IBIC_user=anyone&IBIC_pass=anyone";
    launchURL = launchURL + "&IBIF_cmd=MNTCON+APPPATH+IBISAMP;MNTCON+EX+MNTIVP;";
    launchURL = launchURL + "×tamp=" + getRandomNum;
window.open(launchURL,"_blank","toolbar=no, menubar=yes");
var ie7 = (document.all && !window.opera && window.XMLHttpRequest) ? true : false;  
     if (ie7) 
      {     
           //This method is required to close a window without any prompt for IE7
           window.open('','_self','');
           window.close();
      }
     else 
           {
           //This method is required to close a window without any prompt for IE6
           this.focus();
           self.opener = this;
           self.close();
           }
</script>
</body>
</html>


September 10, 2009, 11:20 AM
GamP
And still, the user might still be able to hit the backspace button. And when the cursor is not on any element of the document, but for instance on the form itself, it is actually the same as hitting the back button. The app will disconnect when that happens, just as when the back arrow is clicked.
I have created a small javascript to prevent that. Here it is:
document.onkeydown = catchIt;

function catchIt() {
 var curelem = document.activeElement.name;
 if (window.event.keyCode == 8) {
  if (typeof curelem == "undefined") { return false; }
  return true;}
}
Bind it to the form and backspace button usage will be restricted to active elements only. No more unwanted disconnects.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
September 10, 2009, 04:59 PM
Waz
Also be aware that alt-left arrow and alt-right arrow does the same thing, and if using GamP's suggestion, add these to the check.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

July 26, 2012, 11:49 AM
Wayne at INFORM
I am new to javascript is typeof a javascript command and what if the active element is the form name?

document.onkeydown = catchIt;

function catchIt() {
var curelem = document.activeElement.name;
if (window.event.keyCode == 8) {
if (typeof curelem == "undefined") { return false; }
return true;}
}


WF 7.1.6
UNIX 5.0
HTML