开发者

Can't call Silverlight from JavaScript in Firefox Mac

I'm creating a Silverlight control using Silverlight.js like so:

var properties = {
    width: '640px',
    height: '480px', 
    background: 'black', 
    version: '2.0.0.0'
};

var events = { 
    onError: function() { alert('eek!'); }, 
    onLoad: function(sender, args) { sender.content.Page.foo(); }
};

Silverlight.createObject(
    '/beta/ClientBin/DeepZoomProject.xap',  // source
    container,  // parent element
    'slPlugin',  // id for generated object element
    properties, 
    events,
    '',
    'context'    // context helper for onLoad handler.
);

Inside the Silverlight control I've done the right stuff to make it scri开发者_高级运维ptable:

[ScriptableType]
public partial class Page : UserControl {
    public Page() {
        InitializeComponent();
        HtmlPage.RegisterScriptableObject("Page", this);
    }

    [ScriptableMember]
    public void foo() {
        // doing something here
    }
}

... and in fact it works just fine in IE8, Firefox, Safari and Chrome in Windows, as well as Safari and Chrome on the Mac. It does not, however, work in Firefox (3.6) on the Mac. In Firefox, sender.content has no Page (or page, for that matter). It does have a root, but I don't know where to go from there.

Any thoughts on what I can try next?


Turns out it was a problem with my Silverlight installation; only happened on that one machine, and when I reinstalled Silverlight, everything was fine.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜