Pergunta

I have a button that is visible only for certain item's page. Clicking the button leads to the item's detail page. On hitting the browser's back button, the item page is rendered without the button. And, if I hit refresh then the button appears. How do I render the button as well without refreshing.

Thanks!

Foi útil?

Solução

just in case anyone is looking, for the button to be visible some other .cshtml page was handling it based on some event response, using a script that removed the "invisible" from its css. So, on hitting the browser back button the event would not be called and hence the button was still invisible. I needed to make the button visible. The only workaround I found was this -- a hidden check included in the target page after hitting the browser back button.

    <script type="text/javascript">
       onload = function () {
         var e = document.getElementById("reloaded");
         if (e.value == "no") e.value = "yes";
         else { e.value = "no"; location.reload(); }
       }
    </script>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top