문제

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!

도움이 되었습니까?

해결책

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>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top