Solved

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

Posted on 2013-05-24
3
805 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
Comment Utility
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-
Comment Utility
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
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This video teaches viewers about errors in exception handling.

743 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now