سؤال

I have the following to refresh my page when clicked on href.

    <a href="javascript:history.go(0)">Click to refresh the page</a>

I have this

    <meta http-equiv="no-cache"> 

in the head tag. Even then I am getting a cached copy. How can I avoid loading cached copy?

هل كانت مفيدة؟

المحلول

instead of

javascript:history.go(0);

you may use

javascript:window.location.reload();

نصائح أخرى

<a onclick="window.location.href=this">test</a>

In your <meta> tag, you're missing a content attribute. try this

<meta http-equiv="expires" content="0" />
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="expires" content="-1" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />

You could also try

<a href="javascript:window.location.reload();">

but I'm not sure how that would work with regards to caching

Try this

window.location.href=window.location.href

Try This:

   <a class="refresh_link" href="javascript:void(0)">click to Refresh the Page</a>


<script type="text/javascript">

$(document).ready(function(){



    $(".refresh_link").click(function(){

     location.reload();



    });

});
</script>

Used jquery

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top