2

I've noticed that the Kik share button has a data-url attribute, and the documentation even has a share button builder which supports URL's, but in my testing, the data-url attribute is ignored, instead it always shares the current URL.

Here's an example:

<a class="kik-button kik-color-lg" 
   data-url="http://example.com/something" 
   data-title="Something" 
   data-description="Something" 
   data-pic="http://example.com/example.png">
</a>

If you are on the page http://example.com - pressing the share button will share a card which brings you to http://example.com NOT http://example.com/something

I also noticed there isn't actually any "url" item when using kik.send natively, leading me to confusion to what's actually supposed to have been sent.

Another semi-related issue is that I'm trying to hide the share button on non-kik devices, so they can still use the site like normal, however kik.enabled is only true when the user first loads the page, as soon as they navigate to another page, kik.enabled is suddenly false, causing the share button to disappear. Why is this?

(Note: kik.enabled works perfectly fine when using the Kik Developer tools in Chrome, @kik devs, I really wish the Developer Tools were closer to the Kik App, I've built a few apps and usually they work fine in my browser with the Kik tools, but are completely broken within Kik itself)

Someguy123
  • 1,324
  • 13
  • 27

1 Answers1

-1

The the kik-share-button script tries to send the value of data-url as a url parameter to kik.send() :

function setupShareButton(link) {
    link.style.display = "inline-block";
    link.setAttribute("title", "Share this on Kik!");
    link.addEventListener("click", function(event) {
        var link = this,
            data = {},
            n, m, i, h;
        n = link.getAttribute("data-title");
        if (n) {
            data.title = n
        } else {
            data.title = document.title
        }
        m = link.getAttribute("data-description");
        if (m) {
            data.text = m
        }
        i = link.getAttribute("data-pic");
        if (i) {
            data.pic = i
        }
        h = link.getAttribute("data-url");
        if (h) {
            data.url = h
        }
        kik.send(data);
        // don't follow the link normally unless a previous command threw an error
        return false
    })
}

But the kik.send() documentation doesn't mention the url parameter. It's possible that this is an error in the share button script. An invalid parameter name would likely result in the default behavior of sending the current page's url. Maybe it is meant to be part of the data parameter:

kik.send({
  title: '...',
  text: '...',
  data: {url: '...'}
})

in which case a small modification to the share button script could produce the correct functionality.

Phssthpok
  • 1,629
  • 1
  • 14
  • 21