My recommendation is to use the same system used by smartbanner.js which
uses a cookie to detect if the use has already clicked on the close
button so the banner will only show up just after X days.

https://github.com/jasny/jquery.smartbanner/blob/master/jquery.smartbanner.js#L177
https://github.com/jasny/jquery.smartbanner/blob/master/jquery.smartbanner.js#L190

if we can create the "sb-closed" cookie before smartbanner code is
exectued the banner will never show up

i would use something like :

var i, x, y, ARRcookies = document.cookie.split(";");
for (i = 0; i < ARRcookies.length; i++) {
    x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("="));
    y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1);
    x = x.replace(/^\s+|\s+$/g, "");
    if (x == 'sb-closed') {
        if (!decodeURI(y)) {
            var exdate = new Date();
            var exdays = 1826; // 1826days ~ 5 years
            exdate.setDate(exdate.getDate() + exdays);
            value = encodeURI('true') + ((exdays == null) ? '' : '; expires=' + 
exdate.toUTCString())
            document.cookie = 'sb-closed=' + value + ' path=/;'
        }
    }
}

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1329799

Title:
  CNN.com advertises Google Play app to Ubuntu users

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/webbrowser-app/+bug/1329799/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to