cdugga
cdugga

Reputation: 3859

browser back button doesnt work in cached environment

The back button just causes my page to refresh. Is there a way around this without disabling the cache?

Upvotes: 1

Views: 955

Answers (2)

vijay
vijay

Reputation: 41

where you click on product/image on page there call onclick javascript function i.e.

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

Now, put

$(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]));
}
}

Upvotes: 0

Kon
Kon

Reputation: 27441

Try adding this to your HTML header:

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

Upvotes: 1

Related Questions