When a forms application is web deployed the parent browser window remains opens after exit_form. Is it possible to close the browser window programatically?
Oracle Forms does not provide any default
functionality (e.g a built-in, package procedure or function, applet parameter
etc) to close the parent browser window.
It is possible to create a work-around
using non-Oracle javascript:
(SEE Special chapter for Internet Explorer
version 7 ( IE7))
A: Closing the browser window using
javascript called via WEB.SHOW_DOCUMENT.
1. Create a html file with the following
code e.g.close.html for Internet Explorer:
<html>
<body onload="closeit()">
<script>
function closeit()
{
window.close();
}
</script>
</body>
</html>
<html>
<body onload="closeit()">
<script>
function closeit()
{
window.close();
}
</script>
</body>
</html>
2. Place in this html in a directory which
can be accessed via a Oracle HTTP Server virtual directory / alias
3. In the Forms module add the code
WEB.SHOW_DOCUMENT('http://machinename.domain:portno/mydirectory/close.html','_self');
in a Post-FORM Trigger.
When the form is then run over the web,
the trigger will fire calling the close.html which will in turn close the
parent browser window.
B: Simulate Oracle Forms
separateFrame=True using javascript
Create a HTML file with the following
code:
<HTML>
<HEAD>
<TITLE>My HTML</TITLE>
<SCRIPT>
function my_function()
{
// Replace Oracle.com URL below with typical Forms Servlet URL
window.open("http://machinename.domain:portno/forms/frmservlet?form=test.fmx","_blank","menubar=0, location=0,toolbar=0,personalbar=0,status=0,scrollbars=1
, resizable=1,width=700,height=550");
// These lines close the first browser window after link is clicked.
win = top;
win.opener = top;
win.close ();
}
</SCRIPT>
</HEAD>
<body onload="javascript:my_function">
<p align="center"><img border="0"
src="http://www.oracle.com/admin/images/oralogo.gif" width="175" height="28">
<br>
<p align="center"><a href="javascript:my_function()">
Click me to run the application.</a> </p>
</body>
</HTML>
<HEAD>
<TITLE>My HTML</TITLE>
<SCRIPT>
function my_function()
{
// Replace Oracle.com URL below with typical Forms Servlet URL
window.open("http://machinename.domain:portno/forms/frmservlet?form=test.fmx","_blank","menubar=0, location=0,toolbar=0,personalbar=0,status=0,scrollbars=1
, resizable=1,width=700,height=550");
// These lines close the first browser window after link is clicked.
win = top;
win.opener = top;
win.close ();
}
</SCRIPT>
</HEAD>
<body onload="javascript:my_function">
<p align="center"><img border="0"
src="http://www.oracle.com/admin/images/oralogo.gif" width="175" height="28">
<br>
<p align="center"><a href="javascript:my_function()">
Click me to run the application.</a> </p>
</body>
</HTML>
When this HTML page is run , it will have
a link to launch the forms application. The application will display in a
separate browser window (separateFrame=false). The javascript will, however,
have removed the parent browser menu, toolbar, status bar and scrollbars. This
makes it appear to the
end user as though the forms application
is running in it's own 'MDI' window.
Important Notes:
a. If separateFrame is set to true|yes in
a config or default section of the formsweb.cfg it needs to be changed to
separateFrame=false|no. Otherwise the result will still be the 'appearance' of
a second (parent) browser window containing a black / grey rectangle.
b. When copying and pasting the sample
code into a text file, remove any carriage returns which might result in the
window.open line. Otherwise a javascript error will occur when clicking on the
link to launch the forms application
c. FOR XP servicepack 2 users:
SP2 has tighter security and
shows the message despite the opener=top
To avoid the message:
1) in the HTMLbeforeForm
parameter in formsweb.cfg the line:
2) adding a
"synchronize;" in the POST_FORM trigger before the
web.show_document
Source : Oracle Metalink Note 201481.1