Browse Source

安全策略

zhangjie 2 years ago
parent
commit
7da24d4e34
1 changed files with 34 additions and 33 deletions
  1. 34 33
      public/index.html

+ 34 - 33
public/index.html

@@ -1,40 +1,41 @@
 <!DOCTYPE html>
 <html lang="en">
+  <head>
+    <meta charset="utf-8" />
+    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
+    <meta name="viewport" content="width=device-width,initial-scale=1.0" />
+    <meta http-equiv="Content-Security-Policy" content="script-src 'self'" />
+    <link rel="icon" href="<%= BASE_URL %>favicon.ico" />
+    <title>题库</title>
+    <script>
+      var _hmt = _hmt || [];
 
-<head>
-  <meta charset="utf-8" />
-  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
-  <meta name="viewport" content="width=device-width,initial-scale=1.0" />
-  <link rel="icon" href="<%= BASE_URL %>favicon.ico" />
-  <title>题库</title>
-  <script>
-    var _hmt = _hmt || [];
-
-    if (navigator.appVersion.includes("Chrome/")) {
-      try {
-        _hmt.push([
-          "_setUserTag",
-          "4873",
-          navigator.appVersion.match(/(Chrome\/\d\d)/)[0],
-        ]);
-      } catch (e) {
-        _hmt.push(["_setUserTag", "4873", navigator.appVersion]);
+      if (navigator.appVersion.includes("Chrome/")) {
+        try {
+          _hmt.push([
+            "_setUserTag",
+            "4873",
+            navigator.appVersion.match(/(Chrome\/\d\d)/)[0],
+          ]);
+        } catch (e) {
+          _hmt.push(["_setUserTag", "4873", navigator.appVersion]);
+        }
       }
-    }
-
-    _hmt.push(["_setUserTag", "4889", navigator.appVersion]);
-    _hmt.push(["_setUserTag", "4894", navigator.userAgent]);
-  </script>
-  <!-- <script src="<%= BASE_URL %>ckeditor/ckeditor.js"></script> -->
-</head>
 
-<body>
-  <noscript>
-    <strong>We're sorry but vue-starter doesn't work properly without JavaScript
-      enabled. Please enable it to continue.</strong>
-  </noscript>
-  <div id="app"></div>
-  <!-- built files will be auto injected -->
-</body>
+      _hmt.push(["_setUserTag", "4889", navigator.appVersion]);
+      _hmt.push(["_setUserTag", "4894", navigator.userAgent]);
+    </script>
+    <!-- <script src="<%= BASE_URL %>ckeditor/ckeditor.js"></script> -->
+  </head>
 
+  <body>
+    <noscript>
+      <strong
+        >We're sorry but vue-starter doesn't work properly without JavaScript
+        enabled. Please enable it to continue.</strong
+      >
+    </noscript>
+    <div id="app"></div>
+    <!-- built files will be auto injected -->
+  </body>
 </html>