Results 1 to 2 of 2

Thread: Loading Java Applet

  1. #1
    Join Date
    Aug 2007
    Location
    Ft Myers, FL
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Loading Java Applet

    I have a few pages that load a java viewer for my end users to view tiff images.

    I have the viewer in an IFRAME.

    Everything seems to be displaying ok in IE (windows), Mac (Safari and Firefox)

    What does not seem to work is in Windows Firefox.

    I am wondering I should just set the height and width to pixels because I know the size of my IFRAME I am using in the browser.

    Do you see anything wrong wtih the way this is working (the vendor provided this as an example)


    Iframe Code
    Code:
    <div style="width:850px; height:725px;">
    <iframe width="98%" height="725px" scrolling="no" src="viewer.asp"></iframe>
    </div>
    JS Function

    Code:
    <SCRIPT LANGUAGE="javascript">
    	var _info = navigator.userAgent;
    	var needWindowSize = false;
    
    	defaultStatus="Loading Viewer...";
    
    	// Netscape 6 and beyond on Mac do not interpret percent sizes so we set flag to get
    	// applet size from window size
    	if (_info.indexOf("Mac") > 0 && navigator.appName.indexOf("Netscape") >= 0 && navigator.appVersion >= "5") {
    		needWindowSize = true;
    		}
        
    	// IE on Mac and Netscape 6 on Mac does not resize properly, so we must reload the window
    	if ( _info.indexOf("Mac") > 0 && (_info.indexOf("MSIE") >= 0 ||
    	        (navigator.appVersion >= "5" && navigator.appName.indexOf("Netscape") >= 0) ) ) {
    	    window.onresize=resizeFunc;
    	    }
    
    	// reload window on resize (for IE on Mac and Netscape 6 on Mac)
    	function resizeFunc() {
    	    location = location.href;
    	}
    
    	// Called after applet is done loading.
    	// Set status so that is doesn't change all the time as user moves cursor in
    	// and out of applet
    	function Loaded() {
    		defaultStatus="Viewer running";
    		return true;
    	}
    </SCRIPT>
    Here is the code to load the viewer....

    Code:
    <SCRIPT LANGUAGE="javascript">
    document.write("<applet codebase='javabin' code='test.class' archive='test.jar' id=viewer name='viewer' hspace=0 vspace=0 ");
    document.write("ALT='Java capability is required to view images. Check the browsers options to make sure that Java is enabled' ");
    if (needWindowSize) {
    	document.write("width="+(innerWidth) +" height=" + (innerHeight) + ">");
    } else
        document.write("width=100% height=100%>");
    </SCRIPT>

  2. #2
    Join Date
    Aug 2007
    Location
    Ft Myers, FL
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    The height of the applet seems to be what is left to display on the screen from where the IFRAME starts.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •