Solved

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

Posted on 2013-05-24
3
817 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Application launch issue with Apache Tomcat 5 19
Form with Modals 16 42
expectj telnet failing 5 19
MySqlDump not dumping triggers 1 13
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

930 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