修复本地开发base标签问题,添加内联脚本提前移除
This commit is contained in:
15
index.html
15
index.html
@@ -21,6 +21,21 @@
|
||||
<!-- Base Path for Subdirectory Deployment -->
|
||||
<base href="/g2026/g4/">
|
||||
|
||||
<!-- Smart Path Detection - Must run before CSS/JS loading -->
|
||||
<script>
|
||||
(function() {
|
||||
const hostname = window.location.hostname;
|
||||
// 本地开发环境自动移除 base 标签
|
||||
if (hostname === 'localhost' || hostname === '127.0.0.1' || hostname === '') {
|
||||
const baseTag = document.querySelector('base');
|
||||
if (baseTag) {
|
||||
baseTag.remove();
|
||||
console.log('🔧 Local dev mode: base tag removed');
|
||||
}
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
|
||||
<!-- Stylesheet -->
|
||||
<link rel="stylesheet" href="css/style.css">
|
||||
|
||||
|
||||
Reference in New Issue
Block a user