私はこのコードを試しています:
<!DOCTYPE html>
<html>
<head>
<script src="jquery.js"></script>
<script>
$(document).ready(function(){
$("p").click(function(){
var stateObj = { foo: "bar" };
history.pushState(stateObj, "page 2", "bar.html");
});
});
</script>
</head>
<body>
<p>If you click on me, I will disappear.</p>
</body>
</html>
をクリックするp
と、URL のパスが に変わると思いますbar.html
。このファイルをデスクトップから試しているので、URL はfile:///C:/Documents%20and%20Settings/Cupidvogel/Desktop/hist.html
. ただし、 をクリックしても何も起こりませんp
。ここで何が間違っていますか?