473,399 Members | 3,302 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

java plugin targeting through javascript

Adding an applet to a web page through the <object> tag, allows you to
target the JVM in 2 ways.

(ref. http://java.sun.com/products/plugin/versions.html )

1. "Dynamic Versioning", which basically means "run with version X or
greater".
2. "Static Versioning", which targets a very specific version, e.g.
1.3.1_06.

Sadly, the reality for developers is neither. Usually an application
is developed/tested for a specific range of versions, e.g. 1.3.1_02 ->
1.3.1_07.

I thought I might be able to use some JavaScript trick to iterate
through a few "Static Versioned" values, and stop when a successful
applet initialization took place.

I don't really do much JavaScripting so I have been unsuccessful. Any
help is appreceated. Here is an example first attempt (minus
irrelevent stuff) so you know I'm not completely lazy:
<html>
<head>
<title>Plugin Target Test</title>
<script type="text/javascript">

function tryV(version)
{
document.write('trying ' + version + '<br>');

for (i=0; i<version; i++) //has an earlier version worked?
{

if(document.getElementById("version" + i)!=null) // NOTE: this
doesn't really do what I want, but the idea is there
return;
}


//classid value targets Java 1.3.1_0[version]
document.write('<OBJECT id="version' + version + '" classid =
"clsid:CAFEEFAC-0013-0001-000' + version + '-ABCDEFFEDCBA" ');
//document.write(' codebase =
"http://java.sun.com/products/plugin/autodl/jinstall-1_4_2-windows-i586.cab#Version=1,4,2,0"
');
document.write(' WIDTH = 100% HEIGHT = 100% NAME = "Applet"
ALIGN = center > ');
document.write(' <PARAM NAME = CODE VALUE = "com.foo.Bar" > ');
document.write(' <PARAM NAME = ARCHIVE VALUE = " ');
document.write(' jar1.jar, jar2.jar" ');
document.write(' <PARAM NAME = NAME VALUE = "Applet" > ');
document.write(' <PARAM NAME = "type" VALUE =
"application/x-java-applet;jpi-version=1.3"> ');
document.write(' <PARAM NAME = "scriptable" VALUE = "false"> ');
document.write(' <PARAM NAME = "PROPERTIES"
VALUE="applet.properties"> ');
document.write(version + 'no good<br> ');
document.write(' </OBJECT>');

}

</script>
</head>
<body>

<!--"CONVERTED_APPLET"-->
<!-- HTML CONVERTER -->
<script type="text/javascript">

//try some acceptable values
tryV(3);
tryV(4);
tryV(5);
tryV(6);

</script>
</body>
</html>
Jul 20 '05 #1
1 2164

"mark" <z5*@hotmail.com> wrote in message
news:fe**************************@posting.google.c om...
| Adding an applet to a web page through the <object> tag, allows you to
| target the JVM in 2 ways.
|
| (ref. http://java.sun.com/products/plugin/versions.html )
|
| 1. "Dynamic Versioning", which basically means "run with version X or
| greater".
| 2. "Static Versioning", which targets a very specific version, e.g.
| 1.3.1_06.
|
| Sadly, the reality for developers is neither. Usually an application
| is developed/tested for a specific range of versions, e.g. 1.3.1_02 ->
| 1.3.1_07.

I thought you could get the JVM version from the various browser's object
models. I know you can use VBScript in IE to create Java objects of a
specific version and have seen scripts that iterate until they hit one that
returns an object. Not sure how to do it in JS though.

|
| I thought I might be able to use some JavaScript trick to iterate
| through a few "Static Versioned" values, and stop when a successful
| applet initialization took place.
|
| I don't really do much JavaScripting so I have been unsuccessful. Any
| help is appreceated. Here is an example first attempt (minus
| irrelevent stuff) so you know I'm not completely lazy:
|
|
| <html>
| <head>
| <title>Plugin Target Test</title>
| <script type="text/javascript">
|
|
|
| function tryV(version)
| {
| document.write('trying ' + version + '<br>');
|
| for (i=0; i<version; i++) //has an earlier version worked?
| {
|
| if(document.getElementById("version" + i)!=null) // NOTE: this
| doesn't really do what I want, but the idea is there
| return;
| }
|
|
|
|
| //classid value targets Java 1.3.1_0[version]
| document.write('<OBJECT id="version' + version + '" classid =
| "clsid:CAFEEFAC-0013-0001-000' + version + '-ABCDEFFEDCBA" ');
| //document.write(' codebase =
|
"http://java.sun.com/products/plugin/autodl/jinstall-1_4_2-windows-i586.cab#
Version=1,4,2,0"
| ');
| document.write(' WIDTH = 100% HEIGHT = 100% NAME = "Applet"
| ALIGN = center > ');
| document.write(' <PARAM NAME = CODE VALUE = "com.foo.Bar" > ');
| document.write(' <PARAM NAME = ARCHIVE VALUE = " ');
| document.write(' jar1.jar, jar2.jar" ');
| document.write(' <PARAM NAME = NAME VALUE = "Applet" > ');
| document.write(' <PARAM NAME = "type" VALUE =
| "application/x-java-applet;jpi-version=1.3"> ');
| document.write(' <PARAM NAME = "scriptable" VALUE = "false"> ');
| document.write(' <PARAM NAME = "PROPERTIES"
| VALUE="applet.properties"> ');
| document.write(version + 'no good<br> ');
| document.write(' </OBJECT>');
|
| }
|
| </script>
| </head>
| <body>
|
| <!--"CONVERTED_APPLET"-->
| <!-- HTML CONVERTER -->
| <script type="text/javascript">
|
| //try some acceptable values
| tryV(3);
| tryV(4);
| tryV(5);
| tryV(6);
|
| </script>
| </body>
| </html>
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: ewright66 | last post by:
I'm trying to access CiscoWorks 2000 from a home PC via VPN on a Win XP Home Edition computer. CiscoWorks requires Java JRE 1.3.1 to apparently open applets. When I try to bring up a Topology Map...
2
by: Eyal | last post by:
Hey, I would appriciate if anyone can help on this one: I have a java object/inteface having a method with a boolean parameter. As I'm trying to call this method from a javascript it fails on...
1
by: Jan Vinten | last post by:
Hello, I'm looking for a javascript, that can detect which java VM is installed and what the current version is. Can any of you give me some details? Best regards, Jan Denmark
1
by: valere | last post by:
I look for information for communicating between JavaScript and a native plugin. I noticed that LiveConnect is oriented to communicate as a "bridge" between Java and JS. But how to process with a...
4
by: Dani Shapira | last post by:
Hi. can anyone help me with how to find if JAVA is evalible and if yes, of what version? Thanks Dani
2
by: Tim Murray | last post by:
First of all, I don't know much about Java, even its naming and version numbering nomenclature, and second, if there is a better group to ask this in, please let me know. System is Mac with...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
4
by: aotemp | last post by:
Does anyone know how to detect the version of Java installed? My website has an application that requires java 1.5+ to be installed, basically if the user doesn;t already have it installed I...
2
by: cloudy | last post by:
First at all, i'm sorry, i not good in writing english. i want to retrieve a string from my applet via Javascript. I use a method named ReadAll. public String ReadAll(String StrOut, String...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.