Silverlight ScriptableMember in Firefox 'Content is undefined' error.
- by Sergey Mirvoda
Recently I'm learned how to call SIlverlight methods from JavaScript.
All works fine (even in Chrome !).
But in FireFox 3 (3.6.4) registered Page object is undefined.
My Code is very simple
silverlight
[ScriptableMember]
public bool HasFilter()
{
return true;
}
And in MainPage constructor
public MainPage()
{
InitializeComponent();
HtmlPage.RegisterScriptableObject("Page",this);
LayoutRoot.DataContext = viewModel;
Loaded += OnLoaded;
}
JavaScript
<head>
<script type="text/javascript">
function UpdateFilter() {
var sl = document.getElementById('SilverlightChartControl');
alert(sl);
alert(sl.Content.Page.HasFilter());
}
</script>
</head>
<body>
<a href="#" id="resize" onclick="UpdateFilter(); return false;">TEST</a>
</body>