2

I have a xbap application and i would like a javascript button to call a function from this application. I've read something on Internet and it seems i have to use either a webcontrol (is that correct?) or an object control whom to pass an id or something. How should i do that exactly? A small Vb.Net example would be useful.

Let's assume i have this class:

Class Page1
    Public Sub Callback()
        MsgBox("Something")
    End Sub
End Class

And i have a html file with an iframe that looks like this:

<html>
</head>
<script>
function something() {
               var ctrl = document.getElementById("testControl");
              ctrl.Callback();
           }
</script>
</head>
<body>


    <object id="testControl" name="testControl" classid="clsid: ..." width="0" height="0"></object>
    <input type="button" value="Change Size" onclick="something()" />                   
    <br/>
    <script>
       document.write('<iframe id="frame1" name="frame1" width="200" height="197" src="http:// .... .xbap?id=' + 1 + '" frameborder="1" border="1" style="border: 1px solid #000000;" />');
    </script>
</body>
</html>

How should i configure my vb.net class and html file so that it works? thank you.

catalin ilie
  • 121
  • 2
  • 7

1 Answers1

0

This question seems to be unanswered, and is most likely bit duplicate with other questions out there.

But any how, I have created a blog post where there is a javascript button that calls function from xbap. This solution works with latest browsers out there.

Check it out at: http://hotzblog.com/xbap-and-javascript-with-ie9-or-newer-solution-for-missingmethodexception-problems/

Tuukka Lindroos
  • 1,270
  • 10
  • 14