applet tag vs Object tag - java

As per W3Schools HTML applet tag is not supported in HTML5. Need to use <Object> tag instead of <applet> tag.
For more details follow this link: http://www.w3schools.com/tags/tag_applet.asp
http://dev.w3.org/html5/spec/obsolete.html#the-applet-element
Point 11.2 Non-conforming features
So, I go ahead and the change the code.
Below code that is working with <APPLET> tag:
<Applet
style = "position:absolute;border:0px;left:184;top:95;height:180;width:364;"
code = "jtreeviewapplet.JTreeViewAppletMain.class"
name = "TreeView"
id = "TreeView"
hspace = "0"
vspace = "0"
align = "top"
archive = "/Project/HTML/ABC/XYZ.jar,/Project/HTML/ABC/ABC.jar"
MAYSCRIPT>
<PARAM NAME="onSelected" VALUE="onSelect_Handler">
<PARAM NAME="onFinishNormalize" VALUE="onFinishNormalize_Handler">
</Applet>
Here is the snippet; I changed <APPLET> tag to <OBJECT> tag so as to support HTML5 in future:
<OBJECT type=" application/x-java-applet"
style = "position:absolute;border:0px;left:184;top:95;height:180;width:364;"
name = "TreeView"
id = "TreeView"
hspace = "0"
vspace = "0"
align = "top"
>
<PARAM name="code" value=”jtreeviewapplet.JTreeViewAppletMain.class”>
<PARAM name="codebase" value="/Project/HTML/ABC/">
<PARAM name="archive" value=" XYZ.jar">
<PARAM name="archive" value=" ABC.jar">
<PARAM name="scriptable" value="true">
<PARAM NAME="onSelected" VALUE="onSelect_Handler">
<PARAM NAME="onFinishNormalize" VALUE="onFinishNormalize_Handler">
</OBJECT>
After changing the <applet> tag to <object> tag , my applet itself is not loading and it gives class not found exception for jtreeviewapplet.JTreeViewAppletMain.class.
(Note: For both working and not working condition, I am using latest JDK 1.7 update 9 for compiling the code and in my system I am having latest JRE1.7 update 9 to run the applet code. I am using InternetExplorer 8 and InternetExplorer 9 browser)

Just replacing applet by object isn't enough. Read http://www.ailis.de/~k/archives/63-How-to-use-Java-applets-in-modern-browsers.html for an example.

Related

Applet can be loaded in IE and Firefox,but failed in Safari5.1

I use Safari5.1 to load an signed applet on Windows desktop, but it failed and seems the JAVA plug-in NOT started.
The html code like below, do i need to add other parameter for Safari 5.1 ? And is there any other method to load applet in Safari? thanks.
system is Windows, browser version is Safari 5.1
<!--[if !IE]> Firefox and others will use outer object -->
<object classid="java:com.keithley.SCPI.SCPIApplet.class" type="application/x-java-applet;version=1.6" archive="../jar/SCPI.jar" height="480" width="640">
<param name = "scriptable" value = "true">
<!-- Konqueror browser needs the following param -->
<param name = "ARCHIVE" value = "../jar/SCPI.jar">
<!-- (Microsoft Internet Explorer) will use inner object -->
<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" codebase="http://java.sun.com/update/1.6.0/jinstall-6u35-windows-i586.cab#Version=6,0,0,10"
height="480" width="640" >
<param name = "CODE" value = "com.keithley.SCPI.SCPIApplet.class">
<param name = "ARCHIVE" value = "../jar/SCPI.jar">
<param name = "type" value = "application/x-java-applet;version=1.6">
<param name = "scriptable" value = "false">
</object>
<!--[if !IE]> close outer object -->
</object>
Try with <object> and <embed> instead of <object> inside another <object>:
<object classid = "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
codebase="http://java.sun.com/update/1.6.0/jinstall-6u35-windows-i586.cab#Version=6,0,0,10"
width="640" height="480" id="yourAppletId">
<param name = "code" value = "com.keithley.SCPI.SCPIApplet.class">
<param name = "archive" value = "../jar/SCPI.jar">
<param name = "mayscript" value = "true">
<param name = "scriptable" value = "true">
<param name = "type" value = "application/x-java-applet;version=1.6">
<comment>
<embed type = "application/x-java-applet;version=1.6"
code = "com.keithley.SCPI.SCPIApplet.class"
archive = "../jar/SCPI.jar"
scriptable = "true"
width = "640" height = "480"
name = "yourAppletId"
mayscript = "true"
scriptable = "true">
</embed>
</comment>
</object>
Besides if you want to check if the java plugin start, you can go to control panel > Java, select the Advanced tab an on Java console option select Show console radio button.
Hope this helps,
Done, Actually Safari 5.1.7 in Windows does not recognize the JAVA, when we open the page containing JAVA applet,it will pop up the alert "Missing plug-in".

Dynamically set source for embed tag

I was able to embed a media player plugin in zul page and play a video(which comes from an ip camera) by specifying the src,now I was trying do give the source file dynamically but I was not able to get it work.can anyone help me with this.
Thanks in advance
videoPage.zul goes like this
<zscript>
String filePath = (String) Executions.getCurrent().getSession()
.getAttribute("urlReturned");
</zscript>
<p:window xmlns="http://www.w3.org/1999/xhtml">
<OBJECT ID="MediaPlayer" WIDTH="192" HEIGHT="190"
CLASSID="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
STANDBY="Loading Windows Media Player components..."
TYPE="application/x-oleobject">
<param name="FileName" value='${filePath}' />
<PARAM name="autostart" VALUE="false" />
<EMBED TYPE="application/x-mplayer2"
SRC=""
NAME="MediaPlayer" WIDTH="300" HEIGHT="300" ShowControls="0"
ShowStatusBar="0" ShowDisplay="0" autostart="1">
</EMBED>
</OBJECT>
</p:window>
</p:zk>
i would like the path(in my case from a url from an ip camera) at runtime based camera selected by user and display it in the same page.
you can set src of embed tag in javascript, for that you must have to write your embed tag in javascript like below example :
function onclickofSomething()
{
$('#IDOfParentElement').html("<embed type='application/x-mplayer2' pluginspage='http:///www.microsoft.com/Windows/MediaPlayer/' src='" + "<%=YourVideoPath%>" + "YourVideoName" + ID + ".mp4/wmv" + "' autostart='1' showstatusbar='1' enabled='1' showdisplay='1' showcontrols='1' width='630' height='380'></embed>");
};
you can also see below url :
need to set video file name using javascript
http://www.webdeveloper.com/forum/showthread.php?53086-how-to-change-the-src-in-lt-embed-gt-using-javascript
http://www.daniweb.com/web-development/javascript-dhtml-ajax/threads/16626/how-to-change-the-the-value-of-src-in-embed-using-javascript

calling second applet once first applet is loaded in JSP/JSF/HTML

I am working on a JSP/ JSF page where two applets are embeded using tag.
Problem is the first applet is having some information that will be updated on the page and the second applet must use that info to load properly.
I cannot find a way where i can control calling of the applets. (These applets are third party applets other wise i could have combined both applets). i want to know how i can know the first applet is loaded and then call/enable or show 2nd applet.
below are the tags i used for applets on my page.
<object
name="CSHelper" id="CSHelperId"
classid="clsid:9C840-044E-11D1-B3E9-5F499D93"
width="100%"
HEIGHT="0"
ALIGN="middle"
codebase="http://java.sun.com/update/1.5.0/jinstall-1_5_0_11-windows-i586.cab#Version=1,5,0,11">
<param name="code" value="ClientUtil"/>
<param name="ARCHIVE" value="HelperApplet.jar"/>
</object>
<object style="display:none"
name="ivrTelephonyBarName" id="ivrTelephonyBarId"
classid="clsid:89C840-044E-11D1-B3E9-0599D93"
width="100%"
HEIGHT="75"
ALIGN="middle"
codebase="http://java.sun.com/update/1.5.0/jinstall-1_5_0_11-windows-i586.cab#Version=1,5,0,11">
<param name="code" value="<%=cTIConnectionParams.getAppletJarClass()%>"/>
<param name="ARCHIVE" value="<%=cTIConnectionParams.getAppletJar()%>"/>
<param id="AGENT_ID" name="AGENT_ID" value="<%=cTIConnectionParams.getAgentID()%>"/>
<%--<param id="sAgentID" name="sAgentID" value="0202"/>--%>
<param id="AGENT_PASS" name="AGENT_PASS" value="<%=cTIConnectionParams.getAgentPassword()%>"/>
<param id="INSTRUMENT" name="INSTRUMENT" value="<%=cTIConnectionParams.getInstrument()%>"/>
<param id="params" name="params" value="<%=cTIConnectionParams.getParams()%>"/>
<param id="iconsPath" name="iconsPath" value="<%=contextCtiUrl%>images/appletIcons/"/>
<param id="configPath" name="configPath" value="<%=contextCtiUrl%>"/>
</object>
I want to laod "CSHelperId" first and then the last when which is not diaplyed purposely.
Any technique will work for me.
you can do it mixing javascript code in your 1st applet
public void init() {
JSObject document = JSObject.getWindow(this);
String evalString = "document.getElementById('secondAppletPanel').innerHTML = ";
document.eval(evalString + secondAppletHtmlString);
}
now you can build a string with parameters calculated by your first applet modifiyng the string content, also
you need to place and empty div with id secondAppletPanel where you want the second applet to appear and add the mayscript attribute to your first applet (more info JSObject
)

Javascript does not find Applet in IE9

i have got a Problem with Javascript and it´s Communication to an applet.
In every Browser Javascript does find the applet and i can call it´s methods, but in IE9 it does not find the object/applet. heres the code
<div class="speichern" align="center">
<object type="application/x-java-applet" width="10" height="10" id="jsap" name="jsap">
<param name="archive" value="ABD_Downloadmanager.jar,ojdbc6.jar"> </param>
<param name="code" value="Speichern_Applet.class"> </param>
<param name="mayscript" value="yes">
<param name="scriptable" value="true">
</object>
</div>
and the Javascript call :
var appletObj = document.getElementsByName('jsap')[0];
var path = appletObj.test();
the test Method does just return a String return "C:/";
when i use the an alert(appletObj );
Firefox does show me object HtmlObjectElement
But the IE does only show object
i have tried this ways to get the applet without any success:
var appletObj = document.getElementsByID('jsap')[0];
var appletObj = document.getElementsByID('jsap');
var appletObj = document.jsap;
var appletObj = document.applets[0];
for me it looks like the IE simply cannot work with the object tag or something like this? someone got a solution for this or an idea why the IE can not find the object/applet?
Thanks for reading so far
I Just found out the Problem which came up in here.
I was using the style='visible:hidden' attribute. But a hidden DOM object, in this case the Object tag/ applet won´t be loaded by the IE. I just had to set the size to (0,0). Genius...

calling id from applet object throws js error in IE

When calling an applet id from JS giving Object doesn't support this property or method error.
Please check the code...
<!--[if !IE]> Firefox and others will use outer object -->
<object
classid = "java:com.mypack.myclass.ABCClass.class"
type = "application/x-java-applet"
height = "200"
width = "480"
id = "myappletId">
<!-- Konqueror browser needs the following param -->
<param name="cache_archive" value="a.jar, b.jar, c.jar" />
<param name="codebase" value="applets/" />
<param name="OnMouseLeftClickJS" value="showModal()">
<!--<![endif]-->
<!-- MSIE (Microsoft Internet Explorer) will use inner object -->
<object
classid = "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
codebase = "http://java.sun.com/update/1.5.0/jinstall-1_5_0-windows-i586.cab"
height = "200"
width = "480"
id = "myappletId">
<param name="code" value="com.mypack.myclass.ABCClass" />
<param name="cache_archive" value="a.jar, b.jar, c.jar" />
<param name="OnMouseLeftClickJS" value="showModal()">
<param name="codebase" value="applets/" />
<strong>No Java Support</strong>
</object>
<!--[if !IE]> close outer object -->
</object>
<!--<![endif]-->
Now, in my showModal() js function I have,
var myId = document.getElementById("myappletId"); //At this point I am getting the object data.
I perform some operations in my modal window which is a jquery modal window and I have a button in it. When I click on that I am calling a function say xyz().
function xyz() {
var myId = document.getElementById("myappletId");
//At this point myId is getting empty.
}
This is happening in only IE Browser. I tested in IE8.
Works good in Firefox and chrome.
I am not navigating my page and on view source I can see my object tag.
Please help me out.
Thanks in advance...
In your comments you have
<!-- MSIE (Microsoft Internet Explorer) will use inner object -->
How about using document.getElementById('myappletId').getElementById('innerApplet') ?
It would be great idea to use unique id for inner applet, maybe then your solution would work.
Thanks for your effort guys, the mistake is in my code. When I open a modal window making the object tag visibility hidden in the back. Even I am make it visible after closing the modal window, This IE is not identifying it. Weird but true...

Categories