Note that there are some explanatory texts on larger screens.

plurals
  1. POHistory.js Issue
    text
    copied!<p>I got my history API to work however I am trying to implement History.js but I can't seem to access the state.data. I want to use the string in the state.data to9 call the corresponding function. While my concept works well for the History API it doesn't for History.js my code is located below:</p> <pre><code>(function (window, undefined) { var History = window.History; // Note: We are using a capital H instead of a lower h if (!History.enabled) { // History.js is disabled for this browser. // This is because we can optionally choose to support HTML4 browsers or not. return false; } // Bind to StateChange Event History.Adapter.bind(window, 'statechange', function () { // Note: We are using statechange instead of popstate var State = History.getState(); // Note: We are using History.getState() instead of event.state alert(State.data); if (State.data != null) { var strFun = State.data; alert(strFun); //Create the function call from function name and parameter. var mySplitResult = strFun.split(","); //var strParam = "null"; //Call the function and arguments window[mySplitResult[0]](mySplitResult[1], mySplitResult[2]); } }); })(window); </code></pre> <p>My links are as such:</p> <pre><code>&lt;li&gt; &lt;a href="#" onclick="javascript:History.pushState({state:newarticles},'New Articles','newarticle'); return false;"&gt;Articles&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="#" onclick="javascript:History.pushState({state:displaybookmarks},'Favourties','favourties'); return false;"&gt;Favourites&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="#" onclick="javascript:History.pushState({state:pagenation},Listing,1,'Archive','archieve1'); return false;"&gt;Archive&lt;/a&gt; &lt;/li&gt; </code></pre> <p>Any help will be greatly appreciated.</p>
 

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