|
@@ -8,6 +8,44 @@
|
|
|
<link rel="stylesheet" type="text/css" href="./lib/Cesium/Widgets/CesiumWidget/CesiumWidget.css">
|
|
|
<link rel="stylesheet" type="text/css" href="./lib/Cesium/Widgets/CesiumWidget/lighter.css">
|
|
|
<script>window.offline = false</script>
|
|
|
+ <script>
|
|
|
+ // 获取URL参数中的app值
|
|
|
+ function getAppParam() {
|
|
|
+ const urlParams = new URLSearchParams(window.location.search);
|
|
|
+ return urlParams.get('app');
|
|
|
+ }
|
|
|
+
|
|
|
+ // 根据app参数设置favicon
|
|
|
+ function setFavicon() {
|
|
|
+ const appParam = getAppParam();
|
|
|
+ let faviconPath = '/favicon.ico'; // 默认图标
|
|
|
+
|
|
|
+ if (appParam === '1') {
|
|
|
+ faviconPath = '/fire.ico';
|
|
|
+ } else if (appParam === '2') {
|
|
|
+ faviconPath = '/police.ico';
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查找现有的favicon链接元素
|
|
|
+ let link = document.querySelector("link[rel~='icon']");
|
|
|
+
|
|
|
+ // 如果没有找到,创建一个新的
|
|
|
+ if (!link) {
|
|
|
+ link = document.createElement('link');
|
|
|
+ link.rel = 'icon';
|
|
|
+ document.head.appendChild(link);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 设置favicon路径
|
|
|
+ link.href = faviconPath;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 页面加载时设置favicon
|
|
|
+ window.addEventListener('load', setFavicon);
|
|
|
+
|
|
|
+ // 当URL通过History API变化时也更新favicon
|
|
|
+ window.addEventListener('popstate', setFavicon);
|
|
|
+ </script>
|
|
|
</head>
|
|
|
<body>
|
|
|
<div id="app"></div>
|