window.location.hash
JavaScript アクションのリンクを使用する場合、通常は次のようにします。
<a href="#">Link Text</a>
そうすれば、ページが読み込まれる前に誰かがリンクをクリックしても、ひどいことは何も起こりません。
Html ベース タグ
私の現在のプロジェクトでは、これと同じ構成を使用していますが、基本タグを使用しています。
<html>
<head>
<base href="http://example.com/" />
</head>
<body>
<a href="#">Link Text</a>
</body>
</html>
ただし、ページの URL が次の場合:
http://example.com/dir/page
リンクをクリックすると、
http://example.com/#
それよりも
http://example.com/dir/page#
どうすればこれを修正できますか?