I have the following function set up to notify my browser of the current connection type. For some reason this is returning null. AM I doing something wrong? To note, I do not believe getting the value in ScriptNotify is the issue, I am using this same method for other functions which work ok. It seems navigator.connection is null.
JavaScript
function getConnectionType() {
var connectionType = navigator.connection;
window.external.notify("Connection type: " + connectionType.toString());
}
C#
within a button click event I use InvokeScript to call the function
object connectionType = Browser.InvokeScript("getConnectionType");
and then
private void Browser_ScriptNotify(object sender, NotifyEventArgs e)
{
string value = null;
value = e.Value.ToString();
ResultTextBlock.Text = value;
}
EDIT javascript update
function getConnectionType() {
//var connectionType = navigator.connection;
var connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection;
var connectionType = connection.type
window.external.notify("COT" + connectionType);
}