CuDemVN.Wap.Sh



![]() | ![]() ![]() ![]() |
Chức năng:
nhận diện hầu hết các hệ điều hành thông dụng hiện nay:
- Android
- IOS
- Window Phone
- Window PC
- Java
Code:
Bạn đang dùng hệ điều hành <script type="text/javascript"> var infophone=navigator.userAgent.toLowerCase();
cutinfo=infophone.split('\(')[1].split('\)')[0];
cutinfo2=cutinfo.replace(/;/ig,'');
if(cutinfo2.match(/(windows phone)/ig)) {var hdh='Windows Phone';}
else {if(cutinfo2.match(/(android)/ig)) {var hdh='Android';} else {if(cutinfo2.match(/(os|iphone|ipad)/ig)) {var hdh='IOS';} else {if(cutinfo2.match(/(windows)/ig)) {var hdh='Windows PC';} else { var hdh='Java';};};};}; document.write(''+hdh+'');
</script>
Lưu ý: đây chỉ là code cơ bản, bạn có thể tùy biến nó theo mục đích sử dụng!
Cơ chế hoạt động:
dùng hàm navigator.userAgent.toLowerCase() để

→demo:

Hi vọng code này sẽ có ích cho mọi người!
Nguồn: DuyPoppy

Đánh giá: 4.5/ 5, 513 bình chọn
