How to run a script only once in a day on a chrome extention : I'm building a chrome extension that redirect to web page when someone visit a specific site. but I want this to open web page only once in a day. not everytime.

This is what I'm using but isn't working

    function showOnceInADay(){
    var user=getCookie("user");
    if (user != "") {
    } else {
       // content.js
    window.open ('http://google.com')
    }
    }

but it's not working

**Here is the code which i want to run.**

    window.open ('http://google.com')

