Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Executing javascript in Silverlight with Firefox

I am trying to execute a piece of javascript in my silverlight application. Pretty simple example that I have created... Just a single button that tries to execute this line of code...

private void Button_Click(object sender, RoutedEventArgs e)
{
   HtmlPage.Window.Eval("alert('hi');");
}

The alert window does come up but it freezes firefox, I have to force quit firefox it never comes back to life.... has anyone ran into this??

I thought maybe a firefox plugin was causing the problem but I have disabled them all with the same results.

The only way I can get it work is if I go to about:config in firefox and set dom.ipc.plugins.enabled.npctrl.dll to false

Any ideas???

like image 302
Gabe Avatar asked Sep 07 '26 17:09

Gabe


1 Answers

Well I think I partially figured this out...

I added this parameter to my Silverlight hosting page...

<param name="windowless" value="true" />

So the whole <div>

 <div id="silverlightControlHost">
    <object data="data:application/x-silverlight-2," type="application/x-silverlight-2"
        width="100%" height="100%">
        <param name="source" value="ClientBin/JavascriptSLTrigger.xap" />
        <param name="onError" value="onSilverlightError" />
        <param name="background" value="white" />
        <param name="minRuntimeVersion" value="4.0.50826.0" />
        <param name="windowless" value="true" />
        <param name="autoUpgrade" value="true" />
        <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0" style="text-decoration: none">
            <img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight"
                style="border-style: none" />
        </a>
    </object>
    <iframe id="_sl_historyFrame" style="visibility: hidden; height: 0px; width: 0px;
        border: 0px"></iframe>
</div>
like image 116
Gabe Avatar answered Sep 10 '26 08:09

Gabe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!