Showing posts with label JQuery. Show all posts
Showing posts with label JQuery. Show all posts

Saturday, 31 October 2015

Remove back button press behaviour of browsers

In most of online examination, developer uses concept of remove browser back button press behaviour, to implements user unable to press browser back button to go previous page .
   This can be acheived using Jquery:-
  This is the code - cheers :)


  window.location.hash="no-back-button";
  window.location.hash="Again-No-back-button";//again because google chrome don't insert first hash into history
  window.onhashchange=function(){
    window.location.hash="";
    history.replaceState('', document.title, window.location.pathname);
  }

  // remove fragment as much as it can go without adding an entry in browser history:
  window.location.replace("#");

  // slice off the remaining '#' in HTML5:    
  if (typeof window.history.replaceState == 'function') {
    history.replaceState({}, '', window.location.href.slice(0, -1));
  }

Adding a Right-click context menu to a webpage

This is the code by which users can add customize right click context menu to web page.