i just want to make cookie null in browser close, but it not entering in null condition [on hold]

100
November 15, 2018, at 06:50 AM

here is my code,

i need to logout during browser or tab close but not during browser reload so for that i just put a cookie, i believe cookie will get null in window.unload event, but it not happening , actually am unable to findout where is the issue happening and why cookie is not getting null in window unload, really get stucked if anyone knows the soultion,then please please help me

please have a look at my code is this idea works

/**
 * This javascript file checks for the brower/browser tab action.
 * It is based on the file menstioned by Daniel Melo.
 * Reference: http://stackoverflow.com/questions/1921941/close-kill-the-session-when-the-browser-or-tab-is-closed
 */
var validNavigation = false;
 $.cookie("test",1,'');
 var cookiename= $.cookie("test");
function endSession() {
  // Browser or broswer tab is closed
  // Do sth here ...
  $.ajax({
        url: 'ajax/User/user_logout',
        type: "POST",
        async: false,
        data: {},
        success: function (response) {
           // global_date_format = response.js_format;
        }
    });
}
function wireUpEvents() {
  /*
  * For a list of events that triggers onbeforeunload on IE
  * check http://msdn.microsoft.com/en-us/library/ms536907(VS.85).aspx
  */
  window.onunload = function() {
      if (!validNavigation) {
          if(cookiename==null){
         endSession();
     }
     else
     {
         alert("shanyy");
     }
      }
  }
  // Attach the event keypress to exclude the F5 refresh
  $(document).bind('keypress', function(e) {
    if (e.keyCode == 116){
      validNavigation = true;
    }
  });
  // Attach the event click for all links in the page
  $("a").bind("click", function() {
    validNavigation = true;
  });
  // Attach the event submit for all forms in the page
  $("form").bind("submit", function() {
    validNavigation = true;
  });
  // Attach the event click for all inputs in the page
  $("input[type=submit]").bind("click", function() {
    validNavigation = true;
  });
}
// Wire up the events as soon as the DOM tree is ready
$(document).ready(function() {
  wireUpEvents();  
});
Rent Charter Buses Company
READ ALSO
How to count duplicates by multiple records in subtable in MySQL

How to count duplicates by multiple records in subtable in MySQL

Say I have the following table structure:

184
Swap primary keys in mysql

Swap primary keys in mysql

I am trying to achieve the same thing as asked in this question sql swap primary key values but I can't seem to get it running with newer mysql versions becausue of the error message Error Code: 1706Primary key/partition key update is not allowed since the table is updated...

329
Update trigger causing the column of destination table to set to zero

Update trigger causing the column of destination table to set to zero

Update trigger is causing the column of destination table to set to zero Here is the code

122
How to load in data from database to listbox

How to load in data from database to listbox

My program can load in the listbox headers, but not the actually data from the whole table

102