Я изучаю технику: History API pushState (HTML5)
Мне нужна команда для работы с перенаправлением URL, потому что у меня есть сервер CherryPy.
Я не могу передать данные из Cherrypy (с шаблоном Mako в Javascript), но я хочу изменить URL-адрес.
Старый URL
file:///media/DATA/prototypefin4/s.html
и автоматически добавляя foo=1&foo=2
(переменная s) в URL-адрес с помощью History.pushState
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>