|
49 | 49 | <script type="module" defer> |
50 | 50 | import {isSupported, isPolyfilled, baseSupport, apply, polyfills} from '../lib/index.js' |
51 | 51 | // import {isSupported, isPolyfilled, apply, poyfills} from 'https://unpkg.com/@github/browser-support@latest/lib/index.js' |
52 | | - function getBrowser(useragent) { |
53 | | - if ('userAgentData' in navigator) { |
54 | | - const {brand, version} = Array.from(navigator.userAgentData.brands).pop() |
55 | | - return [brand, version] |
56 | | - } |
57 | | - const parts = useragent.split(' ') |
58 | | - let [name, version] = parts.pop().split('/') |
59 | | - if (name === 'Safari') { |
60 | | - version = parts.pop().split('/').pop() |
61 | | - } |
62 | | - return [name, version] |
63 | | - } |
64 | | - const [browser, version] = getBrowser(navigator.userAgent) |
65 | | - document.getElementById('your-browser').innerText = browser + " " + version |
66 | 52 | for(const el of document.querySelectorAll('[data-code]')) { |
67 | 53 | let supported = false |
68 | 54 | const code = el.getAttribute('data-code') |
|
664 | 650 | ** This feature is used, but we Transpile it to a compatible syntax. |
665 | 651 | </small> |
666 | 652 | </p> |
| 653 | + <script> |
| 654 | + function getBrowser(useragent) { |
| 655 | + if ('userAgentData' in navigator) { |
| 656 | + const {brand, version} = Array.from(navigator.userAgentData.brands).pop() |
| 657 | + return [brand, version] |
| 658 | + } |
| 659 | + const parts = useragent.split(' ') |
| 660 | + let [name, version] = parts.pop().split('/') |
| 661 | + if (name === 'Safari') { |
| 662 | + version = parts.pop().split('/').pop() |
| 663 | + } |
| 664 | + return [name, version] |
| 665 | + } |
| 666 | + const [browser, version] = getBrowser(navigator.userAgent) |
| 667 | + document.getElementById('your-browser').innerText = browser + " " + version |
| 668 | + </script> |
667 | 669 | </body> |
668 | 670 | </html> |
0 commit comments