Domanda

Il pulsante Indietro fa semplicemente aggiornare la mia pagina. Esiste un modo per aggirare questo problema senza disabilitare la cache?

È stato utile?

Soluzione

Prova ad aggiungere questo all'intestazione HTML:

<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">

Altri suggerimenti

dove fai clic sul prodotto / immagine sulla pagina, chiama la funzione javascript onclick, ovvero

function getHashOnBack(valueget) 
{
   location.hash = "#backTo=" + $(window).scrollTop();$(document).height();
}

Ora, metti

$(document).ready(function () 
{
 var ab = window.location.hash.substring(1).split("=");
 if (ab[0] == "backTo") 
 {
  // this would be called automatically when back putton pressed and hav #back=1234   etc. // value in url

  $(window).scrollTop(parseInt(ab[1]));
}
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top