Thursday, 30 March 2017

Facebook getuser returning 0 Active access token required


Facebook getuser returning 0 and An Active access token must be used to query information about the current user


If you are getting above error after March 25, 2017 then you  may be using Facebook API version - 2.2. The reason of this error is facebook api version - 2.2 was only available until March 25,2017. That means you need to upgrade to Another updated version of facebook api. I prefer you to use Facebook API version 2.7 or version 2.8 as they are available until October 2018. 

If you Use Facebook api version 2.3 it is only available until July 2017. Check below dates of all Facebook API versions - 

Facebook API Version & Expiration Dates
Facebook API Version & Expiration Dates ( Image Source Facebook Api Documentation )


Sunday, 26 March 2017

How to call a function before leaving page - Jquery beforeonunload



Hi guys, Shraing Code Snippet for Calling a function before leaving page. It may be required for variety of purposes. you can use it to track statistics for user's leaving from a website page to record that page for bounce pages statistics from where user is leaving website mostly. this is just a simple example you can use it for variety of way.

you can share in comments for which purpose you may require this type of code functionality.

**Jquery Code Example -**

    $(window).bind('beforeunload', function(){
      Func_ToInsert_Record();
      Alert('Thanks And Bye!');
    });

**Javascript Code Example -**


    // Anonymous function
    window.onbeforeunload = function(event) {
      var message = '';
      if (window.event) {
        console.log(window.event);
        console.log(event.currentTarget.performance);
        console.log(event.currentTarget.performance.navigation);
        console.log(event.currentTarget.performance.navigation.type);
       
      }
     
      event = event || window.event;
      event.preventDefault = true;
      event.cancelBubble = true;
      event.returnValue = message;
    }