• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

How to load applet in FireFox, when Java is disabled?

 
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have an applet and I want to display it in the Web-browser. I am using javascript to upload this applet.

I am checking browser�s name by using following command



Then I am adding if-else statement depends on the type of the browser. As follows:



This code works fine in all browsers like IE, NetScape, FireFox etc.

Problem is when user disables/ uninstall Java Runtime from there browser then this code still works fine in IE but in the case of FireFox it goes wrong.

When user goes to Tools/ Options menu in FirFox and unselects the Java Enabled checkbox and after that if tries to load this applet then applet loads as just white screen.
Please let me know if you have any option to load applet in FireFox browser even if the java runtime is disabled.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the Java runtime is disabled, there is no way to run an applet. That's what that setting means - no applets.

Is it possible that the page HTML or the alternate HTML of the applet tag specifies to display that white box?
 
Dhananjay Inamdar
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello

I am planning to solve this problem using following steps
  • - Before loading the Applet check for Java related stuff

  • - Check the browser type
    - If it is IE then don't need to check that Java is enabled or not
    - If it is FireFox then check that Java is Enabled or not
    - If Java is enabled then load the applet
    - If Java is disabled then in the Applet display the message that Java is disabled and guide user how to enable Java and as well provide a link to download a Java (if required)

    I have implemented all but last step in code. I am not clear if Java is disabled then how to display information on Applet as it is becoming plane white screen. It can't display anything if Java is disabled.

    I asked client can we do Java checks on Html page (before loading applet) so that if we found out that Java is not enabled we can display message as well as download link on html only. Client is not accepting this alternative as they don't want to force end-user till the point they visit Applet.

    Any help is appreciated.

    Please let me know if you need more information.

    Thanks
     
    Ulf Dittmer
    Rancher
    Posts: 43081
    77
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    - If Java is disabled then in the Applet display the message that Java is disabled and guide user how to enable Java and as well provide a link to download a Java (if required)


    As I said before, if Java is disabled (or not even installed), then no applet will run. You can use This section]alternate HTML[/url] to display a message to this effect, and provide instructions for enabling or downloading a JVM.
     
    Ranch Hand
    Posts: 245
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I believe it is not a good approach . You should adopt the same approach for IE browsers too . While the applet does load in "your" IE browser , it may not work in the end user's IE browser as they might be at a different patch level .

    Allowing applets to load when Java Runtime is disabled is a potential security loop hole and this might be "corrected" in future IE versions
     
    Dhananjay Inamdar
    Ranch Hand
    Posts: 130
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Due to constraints we are focusing only on the FireFox range of browsers. Our requirement is to support Firefox with JRE version 1.5 or up. To solve the problem of Java Support and JRE version detection, I have added a following JavaScript code. I have added this code in that JSP who is responsible for launching Applet. This code will check Java Support and JRE version before launching Applet, if everything is fine then it will display "Good to go" message or in error condition will display appropriate message about what is missing on user's machine.



    This code works fine on Firefox on Windows, but the same code is not working with Safari browser on Mac. Even when user has JRE version greater than 1.5 then also this code displays "you don't have required java version" message.

    I am not clear why this code is not working on Mac Safari, please let me know your comments.

    Thanks in advance!
     
    Ulf Dittmer
    Rancher
    Posts: 43081
    77
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    How can this code ever work - you're setting 'javaPlugIn' to false, and then later check if it is true.

    Anyway, the MIME type reported by Safari is different from the one you check for, in particular it doesn't include the JDK version information. Here's what I get on Safari:

    Name: Java Plug-in for Cocoa
    Filename: JavaPluginCocoa.bundle
    Description: Java Switchable Plug-in (Cocoa)
    MIME type 1: application/x-java-jnlp-file: JNLP Applications
    MIME type 2: application/x-java-applet: Basic Java Applets

    I would also advise not to hardcode the number '34', but instead to use String.indexOf to find the location after the '=' character. It'll be more stable in the presence of differing strings.
     
    Dhananjay Inamdar
    Ranch Hand
    Posts: 130
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hello

    While doing copy-paste from my actual code to the quetion I forgot following 2-3 lines, my bad



    This way I am setting the value of javaPlugIn variable.

    In my code I will implement your suggestion about not hardcoding '34' and to use the String.indexOf(), thanks for that.

    I am not clear about that if Safari is not adding version in MIME type information then how can I check for the version greater than 1.5?

    Please let me know your comments!

    Thanks in advance!
     
    Ulf Dittmer
    Rancher
    Posts: 43081
    77
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    I am not clear about that if Safari is not adding version in MIME type information then how can I check for the version greater than 1.5?



    You can do that in the applet. The "java.version" property has the JRE version. I realize that you probably don't want the applet to be run at all if the JRE isn't at 1.5, but that's the best you can do. Make sure the applet is compiled with class file format 1.3 or 1.4, whichever is appropriate for your purposes.
     
    Dhananjay Inamdar
    Ranch Hand
    Posts: 130
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi Ulf,

    I JRE version on the MAC is below 1.5 then I don't want to run Applet at all in the Safari on Mac is 100% correct.

    As a user friendly thing, I want to display a message that "You don't have latest version of Java, please download it from Sun site"

    In order to display this message I need to detect the JRE version on USer's MAC Safari.

    I would like to know that how can I do this JRE version detection thing on MAC Safari?

    Thanks a lot in advance!


    Regards,
     
    Hug your destiny! And hug this tiny ad:
    We need your help - Coderanch server fundraiser
    https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
    reply
      Bookmark Topic Watch Topic
    • New Topic