Solved

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

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
jQuery delay animation 3 29
Java string replace 11 46
How to determine if a string is a valid SHA value 7 33
How to create a textarea which saves text in HTML 8 37
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

773 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