Validate beef.net.connection.type value
This commit is contained in:
@@ -18,7 +18,7 @@ beef.net.connection = {
|
|||||||
try {
|
try {
|
||||||
var connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection;
|
var connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection;
|
||||||
var type = connection.type;
|
var type = connection.type;
|
||||||
if (type) return type; else return 'unknown';
|
if (/^[a-z]+$/.test(type)) return type; else return 'unknown';
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
beef.debug("Error retrieving connection type: " + e.message);
|
beef.debug("Error retrieving connection type: " + e.message);
|
||||||
return 'unknown';
|
return 'unknown';
|
||||||
|
|||||||
Reference in New Issue
Block a user