Home Web Front-end JS Tutorial JS code implements computer configuration detection function

JS code implements computer configuration detection function

May 26, 2018 pm 05:40 PM
javascript Detection Configuration

This article mainly introduces the JS code to implement the computer configuration detection function. Friends who need it can refer to it

The following code will share with you the js code to implement the computer configuration detection function. The specific code is as follows:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

220

221

222

223

224

225

226

227

228

229

230

231

232

233

234

235

236

237

238

239

240

241

242

243

244

245

246

247

248

249

250

251

252

253

254

255

256

257

258

259

260

261

262

263

264

265

266

267

268

269

270

271

272

273

274

275

276

277

278

279

280

281

282

283

284

285

286

287

288

289

290

291

292

293

294

295

296

297

298

299

300

301

302

303

304

305

306

307

308

309

310

311

312

313

314

315

316

317

318

319

320

321

322

323

324

325

326

327

328

329

330

331

332

333

334

335

336

337

338

339

340

341

342

343

344

345

346

347

348

349

350

351

352

353

354

355

356

357

358

359

360

361

362

363

364

365

366

367

368

369

370

371

372

373

374

375

376

377

378

379

380

381

382

383

384

385

<!DOCTYPE html>

<html>

  <head>

    <meta charset="UTF-8">

    <title></title>

  </head>

  <style type="text/css">

    h1 {

      text-align: center;

      color: #000046;

    }

    .i {

      display: inline-block;

      vertical-align: middle;

      width: 30px;

      height: 30px;

      margin: 5px 20px;

      background: url(http://yi.sunlands.com/ent-portal-war/images/tc_icon.png) no-repeat;

    }

    .a {

      background-position: 0 0;

    }

    .b {

      background-position: 0 -40px;

    }

    .c {

      background-position: 0 -80px;

    }

    .d {

      background-position: 0 -120px;

    }

    .e {

      background-position: 0 -160px;

    }

    b {

      color: #007ac3;

      padding-right: 10px;

    }

    i {

      color: green;

      font-weight: bold;

    }

    .box {

      width: 460px;

      height: 360px;

      margin: auto;

      padding: 20px;

      border: 2px solid darkgray;

      font-size: 18px;

      border-radius: 10px;

      border-left-width: 10px;

      border-right-width: 10px;

    }

  </style>

  <body>

    <h1>电脑配置检测</h1>

    <hr />

    <p class="box">

      <p> <i class="i a"></i> <b>您的操作系统是: </b> <i id="xitong"></i> </p>

      <p> <i class="i b"></i> <b>您的网络链接状态是: </b> <i id="netline"></i> </p>

      <p> <i class="i b"></i> <b>您当前浏览网速是:</b> <i id="wangsu"></i> </p>

      <p> <i class="i c"></i> <b>您电脑的分辨率是:</b> <i id="fenbianlv"></i> </p>

      <p> <i class="i d"></i> <b>您的浏览器是:</b> <i id="liulanqi"></i> </p>

      <p> <i class="i e"></i> <b>您的flash的版本是:</b> <i id="flash_banben"></i> </p>

    </p>

  </body>

  <script src="jquery-1.12.4.min.js" type="text/javascript" charset="utf-8"></script>

  <script type="text/javascript">

    $(function(){

      if(typeof Obj == "undefined") {

        var Obj = new Object();

      }

      if(typeof Obj.SWFObjectUtil == "undefined") {

        Obj.SWFObjectUtil = new Object();

      }

      Obj.SWFObject = function(_1, id, w, h, _5, c, _7, _8, _9, _a) {

        if(!document.getElementById) return;

        this.params = new Object();

        this.variables = new Object();

        this.attributes = new Array();

        if(_1) this.setAttribute("swf", _1);

        if(id) this.setAttribute("id", id);

        if(w) this.setAttribute("width", w);

        if(h) this.setAttribute("height", h);

        if(_5) this.setAttribute("version", new Obj.PlayerVersion(_5.toString().split(".")));

        this.installedVer = Obj.SWFObjectUtil.getPlayerVersion();

        if(!window.opera && document.all && this.installedVer.major > 7) {

          Obj.SWFObject.doPrepUnload = true;

        }

        if(c) this.addParam("bgcolor", c);

        var q = _7 ? _7 : "high";

        this.addParam("quality", q);

        this.setAttribute("useExpressInstall", false);

        this.setAttribute("doExpressInstall", false);

        var _c = (_8) ? _8 : window.location;

        this.setAttribute("xiRedirectUrl", _c);

        this.setAttribute("redirectUrl", "");

        if(_9) this.setAttribute("redirectUrl", _9);

      };

      Obj.SWFObject.prototype = {

        useExpressInstall: function(_d) {

          this.xiSWFPath = !_d ? "expressinstall.swf" : _d;

          this.setAttribute("useExpressInstall", true);

        },

        setAttribute: function(_e, _f) {

          this.attributes[_e] = _f;

        },

        getAttribute: function(_10) {

          return this.attributes[_10];

        },

        addParam: function(_11, _12) {

          this.params[_11] = _12;

        },

        getParams: function() {

          return this.params;

        },

        addVariable: function(_13, _14) {

          this.variables[_13] = _14;

        },

        getVariable: function(_15) {

          return this.variables[_15];

        },

        getVariables: function() {

          return this.variables;

        },

        getVariablePairs: function() {

          var _16 = new Array();

          var key;

          var _18 = this.getVariables();

          for(key in _18) {

            _16[_16.length] = key + "=" + _18[key];

          }

          return _16;

        },

        getSWFHTML: function() {

          var _19 = "";

          if(navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) {

            if(this.getAttribute("doExpressInstall")) {

              this.addVariable("MMplayerType", "PlugIn");

              this.setAttribute("swf", this.xiSWFPath);

            }

            _19 = "<embed type=\"application/x-shockwave-flash\" src=\"" + this.getAttribute("swf") + "\" width=\"" + this.getAttribute("width") + "\" height=\"" + this.getAttribute("height") + "\" style=\"" + this.getAttribute("style") + "\"";

            _19 += " id=\"" + this.getAttribute("id") + "\" name=\"" + this.getAttribute("id") + "\" ";

            var _1a = this.getParams();

            for(var key in _1a) {

              _19 += [key] + "=\"" + _1a[key] + "\" ";

            }

            var _1c = this.getVariablePairs().join("&");

            if(_1c.length > 0) {

              _19 += "flashvars=\"" + _1c + "\"";

            }

            _19 += "/>";

          } else {

            if(this.getAttribute("doExpressInstall")) {

              this.addVariable("MMplayerType", "ActiveX");

              this.setAttribute("swf", this.xiSWFPath);

            }

            _19 = "<object id=\"" + this.getAttribute("id") + "\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\"" + this.getAttribute("width") + "\" height=\"" + this.getAttribute("height") + "\" style=\"" + this.getAttribute("style") + "\">";

            _19 += "<param name=\"movie\" value=\"" + this.getAttribute("swf") + "\" />";

            var _1d = this.getParams();

            for(var key in _1d) {

              _19 += "<param name=\"" + key + "\" value=\"" + _1d[key] + "\" />";

            }

            var _1f = this.getVariablePairs().join("&");

            if(_1f.length > 0) {

              _19 += "<param name=\"flashvars\" value=\"" + _1f + "\" />";

            }

            _19 += "</object>";

          }

          return _19;

        },

        write: function(_20) {

          if(this.getAttribute("useExpressInstall")) {

            var _21 = new Obj.PlayerVersion([6, 0, 65]);

            if(this.installedVer.versionIsValid(_21) && !this.installedVer.versionIsValid(this.getAttribute("version"))) {

              this.setAttribute("doExpressInstall", true);

              this.addVariable("MMredirectURL", escape(this.getAttribute("xiRedirectUrl")));

              document.title = document.title.slice(0, 47) + " - Flash Player Installation";

              this.addVariable("MMdoctitle", document.title);

            }

          }

          if( this.getAttribute("doExpressInstall") || this.installedVer.versionIsValid(this.getAttribute("version"))) {

            var n = (typeof _20 == "string") ? document.getElementById(_20) : _20;

            n.innerHTML = this.getSWFHTML();

            return true;

          } else {

            if(this.getAttribute("redirectUrl") != "") {

              document.location.replace(this.getAttribute("redirectUrl"));

            }

          }

          return false;

        }

      };

      Obj.PlayerVersion = function(_29) {

        this.major = _29[0] != null ? parseInt(_29[0]) : 0;

        this.minor = _29[1] != null ? parseInt(_29[1]) : 0;

        this.rev = _29[2] != null ? parseInt(_29[2]) : 0;

      };

      Obj.SWFObjectUtil.getPlayerVersion = function() {

        var _23 = new Obj.PlayerVersion([0, 0, 0]);

        if(navigator.plugins && navigator.mimeTypes.length) {

          var x = navigator.plugins["Shockwave Flash"];

          if(x && x.description) {

            _23 = new Obj.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));

          }

        } else {

          if(navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0) {

            var axo = 1;

            var _26 = 3;

            while(axo) {

              try {

                _26++;

                axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + _26);

                _23 = new Obj.PlayerVersion([_26, 0, 0]);

              } catch(e) {

                axo = null;

              }

            }

          } else {

            try {

              var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");

            } catch(e) {

              try {

                var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");

                _23 = new Obj.PlayerVersion([6, 0, 21]);

                axo.AllowScriptAccess = "always";

              } catch(e) {

                if(_23.major == 6) {

                  return _23;

                }

              }

              try {

                axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");

              } catch(e) {}

            }

            if(axo != null) {

              _23 = new Obj.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));

            }

          }

        }

        return _23;

      };

      //获取浏览器flash版本号

      function getFlashVersion() {

        var version = Obj.SWFObjectUtil.getPlayerVersion();

        $("#flash_banben").html(version[&#39;major&#39;] + "." + version[&#39;minor&#39;] + "." + version[&#39;rev&#39;]);

      };

      //获取操作系统屏幕分辨率

      function getScreenSize() {

        return {

          width: screen.width,

          height: screen.height

        };

      }

      $("#fenbianlv").html(getScreenSize().width + "*" + getScreenSize().height);

      function getNetline() {

        $(&#39;#netline&#39;).text("网络已链接");

        window.ononline = function() {

          $(&#39;#netline&#39;).text("网络已链接");

        };

        window.onoffline = function() {

          $(&#39;#netline&#39;).text("网络已断开");

        };

      }

      //获取浏览器版本

      function getExplorerVersion() {

        var Sys = {};

        var ua = navigator.userAgent.toLowerCase();

        var s;

        var result = "";

        (s = ua.match(/qqbrowser\/([\d.]+)/)) ? Sys.qqbrowser = s[1]:

          (s = ua.match(/msie ([\d.]+)/)) ? Sys.ie = s[1] :

          (s = ua.match(/(trident)\/([\d.]+)/)) ? Sys.ie = &#39;11.0&#39; :

          (s = ua.match(/firefox\/([\d.]+)/)) ? Sys.firefox = s[1] :

          (s = ua.match(/chrome\/([\d.]+)/)) ? Sys.chrome = s[1] :

          (s = ua.match(/opera.([\d.]+)/)) ? Sys.opera = s[1] :

          (s = ua.match(/version\/([\d.]+).*safari/)) ? Sys.safari = s[1] : 0;

        if(Sys.ie)

          result = "IE " + Sys.ie;

        else if(Sys.firefox)

          result = "firefox " + Sys.firefox;

        else if(Sys.chrome)

          result = "chrome " + Sys.chrome;

        else if(Sys.opera)

          result = "opera " + Sys.opera;

        else if(Sys.safari)

          result = "safari" + Sys.safari;

        else if(Sys.qqbrowser)

          result = "QQBrowser" + Sys.qqbrowser;

        else

          result = "未知";

        $("#liulanqi").html(result + "(内核)");

      }

      //获取操作系统版本

      function getOsVersion() {

        var opName = "";

        var Name = "";

        var ua = window.navigator.userAgent;

        var isWin = (navigator.platform == "Win32") || (navigator.platform == "Windows") || (navigator.platform == "Win64");

        var isMac = (navigator.platform == "Mac68K") || (navigator.platform == "MacPPC") || (navigator.platform == "Macintosh") || (navigator.platform == "MacIntel");

        if(isMac) {

          opName = "Mac";

          Name = "Mac";

        } else if(isWin) {

          var osN = "";

          if(ua.indexOf("WOW") != -1 || ua.indexOf("Win64") != -1) {

            osN = "64";

          } else {

            osN = "32";

          }

          var osV = ua.substr(ua.indexOf("Windows NT ") + 11, 3);

          switch(osV) {

            case "5.0":

              opName = "Windows XP2000";

              Name = "Win2000";

              break;

            case "5.1":

              opName = "Windows XP ";

              Name = "WinXP";

              break;

            case "5.2":

              opName = "Windows 2003";

              Name = "Win2003";

              break;

            case "6.1":

              opName = "Windows 7 " + osN + "位";

              Name = "Win7";

              break;

            case "6.3":

              opName = "Windows 8 " + osN + "位";

              Name = "Win8";

              break;

            default:

              Name = "Other";

              break;

          }

        } else {

          var isUnix = (navigator.platform == "X11") && !isWin && !isMac;

          if(isUnix) {

            opName = "Unix";

            Name = "Unix";

          } else {

            var isLinux = (String(navigator.platform).indexOf("Linux") > -1);

            if(isLinux) {

              opName = "Linux";

              Name = "Linux";

            } else {

              Name = "Other";

            }

          }

        }

        $("#xitong").html(opName);

      }

      //获取网速

      function getNet() {

        var starttime = new Date();

        var size = 0, //文件长度,由脚本使用HEAD自动计算

          url = "2017-08-22_233329.jpg?" + new Date().valueOf(); //获取文件的长度:

        var xhr = $.ajax({

          type: &#39;get&#39;, //"head",

          url: url,

          success: function(msg) {

            size = xhr.getResponseHeader(&#39;Content-Length&#39;);

            //开始GET数据:

            $.get(url, function(data) {

              var endtime = new Date();

              usetime = endtime - starttime;

              if(usetime == 0) {

                usetime = 10;

              }

              var speed = (size / (1024)) / (usetime / (1000));

              var result_text = speed.toFixed(2);

              $("#wangsu").html(result_text + "KB/S");

            });

          }

        });

      }

      getNet();

      getOsVersion();

      getExplorerVersion();

      getFlashVersion();

      getNetline();

    }());

  </script>

</html>

Copy after login

The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.

Related articles:

Spring MVC front-end and back-end 5 ajax interaction methods

ajax springmvc implements C and View Data exchange method between

Ajax post method directly returns a number starting with 0 error problem analysis

The above is the detailed content of JS code implements computer configuration detection function. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

The perfect combination of PyCharm and PyTorch: detailed installation and configuration steps The perfect combination of PyCharm and PyTorch: detailed installation and configuration steps Feb 21, 2024 pm 12:00 PM

PyCharm is a powerful integrated development environment (IDE), and PyTorch is a popular open source framework in the field of deep learning. In the field of machine learning and deep learning, using PyCharm and PyTorch for development can greatly improve development efficiency and code quality. This article will introduce in detail how to install and configure PyTorch in PyCharm, and attach specific code examples to help readers better utilize the powerful functions of these two. Step 1: Install PyCharm and Python

The working principle and configuration method of GDM in Linux system The working principle and configuration method of GDM in Linux system Mar 01, 2024 pm 06:36 PM

Title: The working principle and configuration method of GDM in Linux systems In Linux operating systems, GDM (GNOMEDisplayManager) is a common display manager used to control graphical user interface (GUI) login and user session management. This article will introduce the working principle and configuration method of GDM, as well as provide specific code examples. 1. Working principle of GDM GDM is the display manager in the GNOME desktop environment. It is responsible for starting the X server and providing the login interface. The user enters

Understand Linux Bashrc: functions, configuration and usage Understand Linux Bashrc: functions, configuration and usage Mar 20, 2024 pm 03:30 PM

Understanding Linux Bashrc: Function, Configuration and Usage In Linux systems, Bashrc (BourneAgainShellruncommands) is a very important configuration file, which contains various commands and settings that are automatically run when the system starts. The Bashrc file is usually located in the user's home directory and is a hidden file. Its function is to customize the Bashshell environment for the user. 1. Bashrc function setting environment

How to configure workgroup in win11 system How to configure workgroup in win11 system Feb 22, 2024 pm 09:50 PM

How to configure a workgroup in Win11 A workgroup is a way to connect multiple computers in a local area network, which allows files, printers, and other resources to be shared between computers. In Win11 system, configuring a workgroup is very simple, just follow the steps below. Step 1: Open the "Settings" application. First, click the "Start" button of the Win11 system, and then select the "Settings" application in the pop-up menu. You can also use the shortcut "Win+I" to open "Settings". Step 2: Select "System" In the Settings app, you will see multiple options. Please click the "System" option to enter the system settings page. Step 3: Select "About" In the "System" settings page, you will see multiple sub-options. Please click

MIT's latest masterpiece: using GPT-3.5 to solve the problem of time series anomaly detection MIT's latest masterpiece: using GPT-3.5 to solve the problem of time series anomaly detection Jun 08, 2024 pm 06:09 PM

Today I would like to introduce to you an article published by MIT last week, using GPT-3.5-turbo to solve the problem of time series anomaly detection, and initially verifying the effectiveness of LLM in time series anomaly detection. There is no finetune in the whole process, and GPT-3.5-turbo is used directly for anomaly detection. The core of this article is how to convert time series into input that can be recognized by GPT-3.5-turbo, and how to design prompts or pipelines to let LLM solve the anomaly detection task. Let me introduce this work to you in detail. Image paper title: Largelanguagemodelscanbezero-shotanomalydete

How to configure and install FTPS in Linux system How to configure and install FTPS in Linux system Mar 20, 2024 pm 02:03 PM

Title: How to configure and install FTPS in Linux system, specific code examples are required. In Linux system, FTPS is a secure file transfer protocol. Compared with FTP, FTPS encrypts the transmitted data through TLS/SSL protocol, which improves Security of data transmission. In this article, we will introduce how to configure and install FTPS in a Linux system and provide specific code examples. Step 1: Install vsftpd Open the terminal and enter the following command to install vsftpd: sudo

Improved detection algorithm: for target detection in high-resolution optical remote sensing images Improved detection algorithm: for target detection in high-resolution optical remote sensing images Jun 06, 2024 pm 12:33 PM

01 Outlook Summary Currently, it is difficult to achieve an appropriate balance between detection efficiency and detection results. We have developed an enhanced YOLOv5 algorithm for target detection in high-resolution optical remote sensing images, using multi-layer feature pyramids, multi-detection head strategies and hybrid attention modules to improve the effect of the target detection network in optical remote sensing images. According to the SIMD data set, the mAP of the new algorithm is 2.2% better than YOLOv5 and 8.48% better than YOLOX, achieving a better balance between detection results and speed. 02 Background & Motivation With the rapid development of remote sensing technology, high-resolution optical remote sensing images have been used to describe many objects on the earth’s surface, including aircraft, cars, buildings, etc. Object detection in the interpretation of remote sensing images

MyBatis Generator configuration parameter interpretation and best practices MyBatis Generator configuration parameter interpretation and best practices Feb 23, 2024 am 09:51 AM

MyBatisGenerator is a code generation tool officially provided by MyBatis, which can help developers quickly generate JavaBeans, Mapper interfaces and XML mapping files that conform to the database table structure. In the process of using MyBatisGenerator for code generation, the setting of configuration parameters is crucial. This article will start from the perspective of configuration parameters and deeply explore the functions of MyBatisGenerator.

See all articles