0
で `index.html`を除去なぜベースHREFとreplaceState()
を使用index.html
に次の簡単なコードとして/is/
設定した:`replaceState`が`/basehref/index.html`
<base href="/is/">
<script>
setTimeout(()=>{
history.replaceState(null, "", "#/some");
}, 2000);
</script>
コードはindex.html
がなくなって実行されると、しかし
http://localhost:8080/index.html
をし、URLは次のようになります:実行されるコードの前にURLは次のようになります
http://localhost:8080/is/#/some
私はそれがこのように見えるように予想:
http://localhost:8080/is/index.html#/some
はなぜindex.html
が消えましたか?
[こちらはW3Cのリンクです](https://www.w3.org/TR/2011/WD-html5-20110113/urls.html#document-base-url) – Pointy
ありがとうございます原因は 'replaceState'ではなく' base href'ですか? –
さて、文書に ' 'タグを入れて、ブラウザが望んだと思うようにします。奇妙なことに、何年ものWebプログラミングで ' 'タグを使ったことはありません。 –
Pointy