HTML5 Inline Script Boilerplate

JS
S
JavaScript

Simple script to quickly test stuff on the frontend. Use `http-server` for a quick Node.js based HTTP server

1<!DOCTYPE html>
2<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
3<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
4<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
5<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
6  <head>
7    <meta charset="utf-8">
8    <meta http-equiv="X-UA-Compatible" content="IE=edge">
9    <title></title>
10    <meta name="description" content="">
11    <meta name="viewport" content="width=device-width, initial-scale=1">
12    <link rel="stylesheet" href="">
13    <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.2.0/socket.io.js"></script>
14  </head>
15  <body>
16    <!--[if lt IE 7]>
17      <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="#">upgrade your browser</a> to improve your experience.</p>
18    <![endif]-->
19    <script type="text/javascript">
20      function init() {
21        var socket = io('http://localhost');
22        socket.on('connect', function(){});
23        socket.on('event', function(data){});
24        socket.on('disconnect', function(){});
25        console.log('im running');
26      }
27      document.addEventListener('readystatechange', function() {
28        if (document.readyState === "complete") {
29          init();
30        }
31      });
32    </script>
33  </body>
34</html>

Created on 1/8/2019