Note that there are some explanatory texts on larger screens.

plurals
  1. POCan you use hash navigation without affecting history?
    text
    copied!<p>I'm afraid it might be <a href="https://stackoverflow.com/questions/1263509/potential-problems-setting-window-location-hash#comment-1098554">impossible</a> but is there a way to change the hash value of a URL <strong>without leaving an entry in the browser's history</strong> and <strong>without reloading</strong>? Or do the equivalent?</p> <p>As far as specifics go, I was developing some basic hash navigation along the lines of:</p> <pre><code>//hash nav -- works with js-tabs var getHash = window.location.hash; var hashPref = "tab-"; function useHash(newHash) { //set js-tab according to hash newHash = newHash.replace('#'+hashPref, ''); $("#tabs li a[href='"+ newHash +"']").click(); } function setHash(newHash) { //set hash according to js-tab window.location.hash = hashPref + newHash; //THIS IS WHERE I would like to REPLACE the location.hash //without a history entry } // ... a lot of irrelavent tabs js and then.... //make tabs work $("#tabs.js-tabs a").live("click", function() { var showMe = $(this).attr("href"); $(showMe).show(); setHash(showMe); return false; }); //hash nav on ready .. if hash exists, execute if ( getHash ){ useHash(getHash); } </code></pre> <p>Using jQuery, obviously. The idea is that <em>in this specific instance</em> 1) making the user go back over every tab change could effectively 'break the back button' by piling up needless references, and 2) not retaining which tab they're <em>currently on</em> if they hit refresh is an annoyance.</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