Last Updated: December 26, 2018
·
6.167K
· kevinsperrine

Mobile Bookmark Bubble

@okamototk, has done some great work to make Google bookmark bubble more compatible with other devices. Get his code here: https://github.com/okamototk/jqm-mobile-bookmark-bubble.

It's very easy to attach the event listener and set a hash parameter, so that the bubble doesn't keep annoying your users. The example below will load the bubble 1 second after the page has loaded if the hash doesn't exist in localStorage.

window.addEventListener('load', function() {
  window.setTimeout(function() {
    var bubble = new google.bookmarkbubble.Bubble();

    var parameter = 'popup_bubble';

    bubble.hasHashParameter = function() {
      return window.localStorage[parameter];
    };

    bubble.setHashParameter = function() {
      if (!this.hasHashParameter()) {
        window.localStorage[parameter] = 1;
      }
    };

    bubble.showIfAllowed();
  }, 1000);
}, false);

1 Response
Add your response

Hi There, can you help on how to implement those code on blogger?
Thanks in advance.

over 1 year ago ·

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.

Security insights from Cside