123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <HTML>
- <HEAD>
- <TITLE>WMI Scripting HTML</TITLE>
- <META http-equiv=Content-Type content="text/html; charset=gb2312">
- <script>
- function validBrowser() {
- var u_agent = navigator.userAgent;
- var browser_name = 'Failed to identify the browser';
- if (u_agent.indexOf('Firefox') > -1) {
- browser_name = 'Firefox';
- } else if (u_agent.indexOf('Chrome') > -1) {
- browser_name = 'Chrome';
- } else if (u_agent.indexOf('Trident') > -1 && u_agent.indexOf('rv:11') > -1) {
- browser_name = 'IE11';
- } else if (u_agent.indexOf('MSIE') > -1 && u_agent.indexOf('Trident') > -1) {
- browser_name = 'IE(8-10)';
- } else if (u_agent.indexOf('MSIE') > -1) {
- browser_name = 'IE(6-7)';
- } else if (u_agent.indexOf('Opera') > -1) {
- browser_name = 'Opera';
- } else {
- browser_name += ',info:' + u_agent;
- }
- document.write('browser_name:' + browser_name + '<br>');
- document.write('u_agent:' + u_agent + '<br>');
- }
- var a = 1;
- if (!(b in window)) {
- var b = 2;
- a += 1
- } else {
- a += 2
- }
- console.log(a)
- console.log(b)
- </script>
- <body onload="validBrowser()">
- </body>
- </html>
|