Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Consider using history API for unsupported browsers or see library on <a href="https://github.com/devote/HTML5-History-API" rel="nofollow">https://github.com/devote/HTML5-History-API</a></p> <p>This Javascript library provides an emulation of HTML5 History API for older browsers.</p> <p>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 <a href="http://diveintohtml5.info/history.html" rel="nofollow">http://diveintohtml5.info/history.html</a> or in the History API Specification <a href="http://www.w3.org/TR/html5/history.html#the-history-interface" rel="nofollow">http://www.w3.org/TR/html5/history.html#the-history-interface</a>.</p> <p>Example of using the library in the pure JS context:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;script type="text/javascript" src="history-2.0.4.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; window.onload = function() { // function for the reference is processed // when you click on the link function handlerAnchors() { // keep the link in the browser history history.pushState( null, null, this.href ); // here can cause data loading, etc. // do not give a default action return false; } // looking for all the links var anchors = document.getElementsByTagName( 'a' ); // hang on the event, all references in this document for( var i = 0; i &lt; anchors.length; i++ ) { anchors[ i ].onclick = handlerAnchors; } // hang on popstate event triggered // by pressing back/forward in browser window.onpopstate = function( e ) { // we get a normal Location object /* * Note, this is the only difference when using this library, * because the object document.location cannot be overriden, so * library the returns generated "location" object within an * object window.history, so get it out of "history.location". * For browsers supporting "history.pushState" get generated * object "location" with the usual "document.location". */ var returnLocation = history.location || document.location; // here can cause data loading, etc. // just post alert( "We returned to the page with a link: " + returnLocation.href ); } } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;a href="/mylink.html"&gt;My Link&lt;/a&gt; &lt;a href="/otherlink.html"&gt;Other Link&lt;/a&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Example of using the library along with JQuery:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;script type="text/javascript" src="history-2.0.4.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(function() { // looking for all the links and hang on the event, // all references in this document $("a").click(function() { // keep the link in the browser history history.pushState( null, null, this.href ); // here can cause data loading, etc. // do not give a default action return false; }); // hang on popstate event triggered // by pressing back/forward in browser $( window ).bind( "popstate", function( e ) { // we get a normal Location object /* * Note, this is the only difference when using this library, * because the object document.location cannot be overriden, so * library the returns generated "location" object within an * object window.history, so get it out of "history.location". * For browsers supporting "history.pushState" get generated * object "location" with the usual "document.location". */ var returnLocation = history.location || document.location; // here can cause data loading, etc. // just post alert( "We returned to the page with a link: " + returnLocation.href ); }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;a href="/mylink.html"&gt;My Link&lt;/a&gt; &lt;a href="/otherlink.html"&gt;Other Link&lt;/a&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload