Restrict user to refresh and back,forward in any browser
Restrict user to refresh and back,forward in any browser
I am working on an evaluation system, In which candidate attempt for an exam. So the page where question and its choices are get rendered is an page with iframe
, In that questions are get render. page which holds iframe
contains JavaScript
timer.
So when questions get render on browser to restrict refresh I have written F5
and ctrl+F5
blocking code so candidate can't refresh using keyboard shortcuts but in browser window one can still use refresh button or back button. Is there any way to disable this? I know playing with browser functionality is not good practice, So is there any way to get out of this.
Answer by Developer for Restrict user to refresh and back,forward in any browser
Try dis to disbale back button.
Or we can remove these from the tool bar
window.open ("URL", "mywindow","status=1,toolbar=0");
Answer by Sankalp Mishra for Restrict user to refresh and back,forward in any browser
You can try this...:-
window.open ("http://viralpatel.net/blogs/", "mywindow","status=1,toolbar=0");
This opens a window without toolbar... NO toolbar no buttons.. :D
Answer by coder for Restrict user to refresh and back,forward in any browser
Try this:
function disableF5(e) { if ((e.which || e.keyCode) == 116) e.preventDefault(); };
Answer by Amogh for Restrict user to refresh and back,forward in any browser
on document.ready
I added this line..
window.history.forward(-1)
Answer by Riyaz Parasara for Restrict user to refresh and back,forward in any browser
bool IsPageRefresh = false; //this section of code checks if the page postback is due to genuine submit by user or by pressing "refresh" if (!IsPostBack) { ViewState["ViewStateId"] = System.Guid.NewGuid().ToString(); Session["SessionId"] = ViewState["ViewStateId"].ToString(); } else { if (ViewState["ViewStateId"].ToString() != Session["SessionId"].ToString()) { IsPageRefresh = true; } Session["SessionId"] = System.Guid.NewGuid().ToString(); ViewState["ViewStateId"] = Session["SessionId"].ToString(); }
Answer by user1060930 for Restrict user to refresh and back,forward in any browser
Please try this for restrict back button in all latest browser.
history.pushState({ page: 1 }, "Title 1", "#no-back"); window.onhashchange = function (event) { window.location.hash = "no-back"; };
Fatal error: Call to a member function getElementsByTagName() on a non-object in D:\XAMPP INSTALLASTION\xampp\htdocs\endunpratama9i\www-stackoverflow-info-proses.php on line 72
0 comments:
Post a Comment