HTML5 History API expansion for browsers not supporting pushState, replaceState
npm install html5-history-apiENGLISH
=============================================================================================================
This Javascript library provides an emulation of HTML5 History API for older browsers.
The library operates according to W3C specification, adding no new or incompatible methods. The library can be used exactly as described, for example, in Dive Into HTML5 book (http://diveintohtml5.info/history.html) or in the History API Specification (http://www.w3.org/TR/html5/browsers.html#the-history-interface).
shell
npm install html5-history-api
`$3
history.js - IE8+ and other browsershistory.ielte7.js - IE6+ and other browsers$3
To enable support for HTML5-History-API polyfill in your library, you need to add one line of code:
`js
var location = window.history.location || window.location;
`code of library looks like this:
`js
(function(){
// To enable support for HTML5-History-API polyfill in your library
var location = window.history.location || window.location; // you library code here
// ....
// ....
// ....
})();
`$3
`html
`$3
`html
My Link
Other Link
`$3
`html
My Link
Other Link
`$3
history.js?basepath=/pathtosite/ - the base path to the site; defaults to the root "/".
history.js?redirect=true - enable link translation.
history.js?type=/ - substitute the string after the anchor; by default "/".
You can also combine options:
history.js?type=/&redirect=true&basepath=/pathtosite/ - the order of options does not matter.
Or execute special method in JavaScript:
`js
history.redirect(/ type = / '/', / basepath = / '/pathtosite/');
`
Demo Site: http://history.spb-piksel.ru/ or http://devote.github.io/demos/history/Follow me on Twitter: https://twitter.com/DimaPakhtinov
-------------------------------------------------------------------------------------------------------------
РУССКИЙ
=============================================================================================================
Библиотека эмулирует HTML5 History API в старых браузерах.
Библиотека, которая не добавляет ненужные методы, заставляя их изучать, а оперирует по спецификации w3c, по интерфейсу History.
Для примера могу привести короткий код как с ней работать.
По принципу мы работаем с HTML5 History API так как описано, например, тут http://htmlbook.ru/html5/history или по спецификации http://www.w3.org/TR/html5/history.html#the-history-interface
$3
`shell
npm install html5-history-api
`$3
history.js - IE8+ и другие браузерыhistory.ielte7.js - IE6+ и другие браузеры$3
Для включения поддержки плагина HTML5-History-API polyfill в своих библиотеках, добавьте строку кода:
`js
var location = window.history.location || window.location;
`код будет выглядеть примерно так:
`js
(function(){
// Включает поддержку плагина HTML5-History-API polyfill
var location = window.history.location || window.location; // код вашей библиотеки
// ....
// ....
// ....
})();
`$3
`html
`$3
`html
My Link
Other Link
`$3
`html
My Link
Other Link
`$3
history.js?basepath=/pathtosite/ - базовый путь к сайту, по умолчанию имеет значение корня "/".
history.js?redirect=true - включить преобразование ссылок.
history.js?type=/ - подставлять подстроку после якоря, по умолчанию имеет символ "/".
Также вы можете комбинировать опции:
history.js?type=/&redirect=true&basepath=/pathtosite/ - порядок опций не имеет значение.
Или выполнить специальный метод в JavaScript:
`js
history.redirect(/ type = / '/', / basepath = / '/pathtosite/');
``Я в Twitter: https://twitter.com/DimaPakhtinov