テクニックを勉強中 : History API pushState (HTML5)
サーバーの CherryPy があるため、URL をリダイレクトしないで動作させるためのコマンドが必要です。
Cherrypy から (Mako テンプレートを使用して Javascript に) データを渡すことができませんが、URL を変更したいと考えています。
旧URLは
file:///media/DATA/prototypefin4/s.html
foo=1&foo=2
History.pushState を使用して Url に (変数 s)を自動的に追加する
file:///media/DATA/prototypefin4/s.html?=foo=1&foo=2
しかし、どのように?
私のコード:
<!DOCTYPE HTML>
<html>
<head>
<title>Example - History API pushState</title>
</head>
<script src="http://balupton.github.com/history.js/vendor/jquery.js"></script>
<script src="http://balupton.github.com/history.js/scripts/bundled/html4+html5/jquery.history.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script>
<body>
<input id = 'button1' type = 'button' value = 'history.pushState' onclick="updateHistory()"/>
<script type = 'text/javascript'>
var count ="?foo=1&foo=2";
function updateHistory()
{
History.pushState(count,null,file:///media/DATA/prototypefin4/s.html);
}
</script>
</body>
</html>