Solved

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

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
email validation 9 47
Html split(text) Part2 6 20
Read text on Table 7 25
Looking for solution to pass data to 3rd-party web platform? 4 24
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
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)

680 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