Solved

How can I appear applet window always on top or in front of IE window ?

Posted on 2013-05-24
3
839 Views
Last Modified: 2013-06-20
Hello,

I have a jsp file which create an applet within html body tags. Also, it is published through Tomcat.

While it is running through Internet Explorer, applet window appears first, then applet window goes behind Internet Explorer window.

How can I appear applet window always on top or in front of IE window ?

Code is like below:

function CreateApplet()
    {
...
...
// Open Applet in separate window
appletWnd = window.open("", "__JVUEWINDOW__", 'resizable=1,width=700,height=600,location=0,menubar=0');
        appletWnd.focus();
        if (appletWnd != null) {
            appletWnd.focus();
...
...
   }

Open in new window


Regards,

Fatih
0
Comment
Question by:TAI-
  • 2
3 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 39196100
Try this

var appletWnd; // global var
function CreateApplet() {

  // Open Applet in separate window
  appletWnd = window.open("", "__JVUEWINDOW__", 'resizable,width=700,height=600');
  if (appletWnd) setTimeout(function() {
    appletWnd.focus();
  },100);
}

or have the window focus itself:

if (appletWnd) {
    appletWnd.document.write('<body onload="window.focus()">...</body>');
    appletWnd.document.close();
}
0
 

Author Comment

by:TAI-
ID: 39200407
Dear mplungjan,

Thanks for your response first. I tried your code but it couldnt work. So, i decided my code to expand much more for being clearly.

// Function CreateApplet() - Creates the HTML code for the Applet
    function CreateApplet()
    {
	
        var CODEBASE = getCodeBase();
        var FILENAME = '<%= strAppletMsg.toString()  %>';
        var JVUESERVER = '<%= sJVueHost %>';
		
		if(JVUESERVER == ''){
			JVUESERVER = getJVueHost()
		}
        var DMS = getContextWithProtocol() + "/com.cimmetry.vuelink.documentum.DMS";	
        var USERNAME = '<%= strUsername %>';
        var GUIFILE = '<%=guiFile%>';
        var FROMOEVF = '<%=fromOEVF%>';

        // Open Applet in separate window
        appletWnd = window.open("", "__JVUEWINDOW__", 'resizable=1,width=700,height=600,location=0,menubar=0');
        appletWnd.focus();
        if (appletWnd != null) {
            appletWnd.focus();
            var doc = appletWnd.document;
            // If AutoVue Applet window exist, set file.
            var japplet = doc.applets["JVue"];
            if (japplet != null) {
            	if (GUIFILE != 'null') {
					japplet.setGUI(GUIFILE);
				}else {
					japplet.setGUI(''); //testing
				}
                japplet.setFileThreaded(FILENAME);
            } else {
                appletWnd.moveTo(0,0);

                // Fix for Java Plugin on IE only
                if (doc.readyState != null) {
                    // alert('Document not ready '+ doc.readyState);
                    var i = 0;
                    while ( i < 100 && doc.readyState != "complete" ) {
                        appletWnd.setTimeout('dummy()', 1000);
                        i++;
                    }
                }

				
				
                // Otherwise, create new Applet page
                var jVuePage =  '<' + 'HTML>\n' +
                                '<' + 'HEAD>\n' +
                                '<TITLE>title</TITLE>\n'  +
                                '<META HTTP-EQUIV="content-type" CONTENT="text/html;charset=UTF-8">\n' +
                                '<' + '/HEAD>\n' +
                                
                                '\n<script' +' language="JavaScript">' +
				'\n <!-' + '- hide script from old browsers' +
				'\n    function SaveMarkups() { ' +
				'\n     window.document.applets["JVue"].saveModifiedMarkups(false); ' +
				'\n     window.document.applets["JVue"].waitForLastMethod(); ' +
				'\n    }' +
				'\n //-' + '-> ' +
				'\n</script' + '> ' +

                                 '<' + 'BODY marginheight="1" marginwidth="0" leftmargin="0" topmargin="0" scroll="no" onBeforeUnLoad="SaveMarkups()">\n' +

                               '<APPLET\n' +
                                    'NAME="JVue"\n' +
                                    'HSPACE="0" VSPACE="0"\n' +
                                    'WIDTH="100%" HEIGHT= "100%"    MAYSCRIPT>\n' +
                                    '<PARAM NAME="EMBEDDED"         VALUE="true">\n' +
                                    '<PARAM NAME="VERBOSE"          VALUE="ALL">\n'+ 
                                    '<PARAM NAME="HEAVYWEIGHT" VALUE="FALSE">\n';
               		
               		if (GUIFILE != 'null') {
		     		jVuePage += "\n<PARAM NAME=\"GUIFILE\" VALUE=\"" + GUIFILE + "\">";
			}
		        jVuePage += '<PARAM NAME="FILENAME"         VALUE="' + FILENAME + '">\n' +
	                            '<PARAM NAME="DMS_PRESERVE_COOKIES" VALUE="JSESSIONID">\n' +
	                            '<PARAM NAME="FROMOEVF" VALUE="' + FROMOEVF + '">\n' +
  	                            '<PARAM NAME="LOCALE" VALUE="EN">\n' +
								'<PARAM NAME="REDIRECTURL" VALUE="<%=sRedirectURL%>">\n' +
                                    '<p><b>Requires a browser that supports Java.</b></p>\n' +
                               '</APPLET>\n'

                                '<' + '/BODY>\n' +
                                '<' + '/HTML>\n';

                if (!appletWnd.closed) {
                    doc.open();
                    doc.writeln(jVuePage);
                    doc.close();
                }
            }
        }
        history.back();
    }

Open in new window


Regards,

Fatih
0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 500 total points
ID: 39213923
This does not work?

if (!appletWnd.closed) {
    doc.open();
    doc.writeln(jVuePage);
    doc.close();
    appletWnd.focus();
}

or

setTimeout(function() { appletWnd.focus(); },100);
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

837 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question