1

I've got a problem with running java applet in MVC 4 application. Same applet works fine in Web Forms app. Code which is working in Web Forms:

 function initApplet() {
        var attributes = {
            id: "appletId",
            code: 'appletCode',
            archive: 'appletArchive.jar',
            width: 1,
            height: 1
        };
        var parameters = {
            jnlp_href: 'APPLICATION.jnlp', codebase_lookup: value = false
        };
        var version = '1.6';
        if (deployJava != null) {
            deployJava.runApplet(attributes, parameters, version);
        }
    }

Same code in MVC which is not working:

 function initApplet() {
        var attributes = {
            id:         "appletId",
            code: "appletCode",
            archive: '@Url.Content("~/Content/appletArchive.jar")',
            width:      1,
            height:     1
        };
        var parameters = {
            jnlp_href: '@Url.Content("~/Content/APPLICATION.jnlp")', codebase_lookup: value = false
        };
    var version = '1.6';
    if (deployJava != null) {
            deployJava.runApplet(attributes, parameters, version);
        }
    }

Code which is calling applet method:

 document.getElementById("someId").value = appletId.appletMethod();

Error which I'm getting is "Object doesn't support property or method 'appletMethod'"

Thanks in advance for any help!

5
  • Maybe this helps: stackoverflow.com/a/7663549/80901 Commented Jun 24, 2016 at 16:42
  • Is there a way to display the resulting resource value, for example with alert('@Url.Content("~/Content/appletArchive.jar")')? Commented Jun 24, 2016 at 16:44
  • Actually this is generated by javascript as '/Content/appletArchive.jar' and '/Content/APPLICATION.jnlp' so seems to be ok Commented Jun 24, 2016 at 16:47
  • Does the MVC version work as expected if you hard-code the resource paths? Commented Jun 24, 2016 at 17:54
  • Nope, still same error. I've also tried to place files in same View folder. Commented Jun 24, 2016 at 18:43

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.