ua_parser_js

Creator: coderz1093

Last updated:

0 purchases

ua_parser_js Image
ua_parser_js Images

Languages

Categories

Add to Cart

Description:

ua parser js

ua_parser_js #
UAParser from JavaScript



Getting Started #
Include ua-parser-js at /web/index.html
<!doctype html>
<html>
<head>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/ua-parser.min.js"></script>
</head>
<body>
</body>
</html>
copied to clipboard
Using HTML #
<!doctype html>
<html>
<head>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/ua-parser.min.js"></script>
<script type="text/javascript">
let parser = new UAParser();
let result = parser.getResult();
var useCanvaskit = false;
if(result.os.name == "Android" && result.browser.major >= 57) {
useCanvaskit = true
} else if(result.os.name == "iOS" && result.browser.major >= 11) {
useCanvaskit = true
}

if(useCanvaskit) {
window.flutterWebRenderer = "canvaskit";
}

console.log("canvaskit: " + useCanvaskit);
console.log(result);
</script>
</head>
<body>
</body>
</html>
copied to clipboard
Using Dart #
import 'package:ua_parser_js/ua_parser_js.dart';

String? defaultFontFamily() {
String? fontFamily;

var uaParser = UAParser();
final result = uaParser.getResult();
print("UAParser: ${result.jsObject()}");
switch (uaParser.getOS().name) {
case "iOS":
fontFamily = "PingFang";
break;
}

print("fontFamily: $fontFamily");
return fontFamily;
}
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.