javascript - Prevent user from going to other tab on website -
i'm not sure how can this, if user on site enters info , selects link or tab without saving, nowadays popup , allow them cancel action. if action canceled, want prevent user going selected link/tab.
can this? i've thought using onuload javascript event i'm not sure how prevent action.
this asp.net site using jquery.
it's rather imperfect solution, close get.
add event handler page:
window.onblur = function() { var flag = confirm("please don't leave! click ok if want leave. hope click cancel , remain me."); if (flag) { window.onblur = undefined; alert("ok can leave now. **sob**"); //the user leaving. can little cleanup here if need to. } }
note: no solution in world prevent user opening browser. or, improve yet, picking mobile phone , browsing there. can't forcefulness user remain focused on app.
i suggest rethink ux design if fragile can't allow user multitask.
javascript asp.net .net
No comments:
Post a Comment