Show "Share" popup

One of the greatest features of Spotify is the ability to share music with your social graph. With a few lines of code, we can interact with the "Share" popup dialog.

The Javascript

/* Instantiate the global sp object; include models */
var sp = getSpotifyApi(1);
var models = sp.require("sp://import/scripts/api/models");

/* The div that will contain the popup */
var element = $('#share');

/* The Spotify URI of the content you want to share */
var content = 'spotify:track:76a6mUM5r7VPexAj37TLjo';

/* Display the popup */
models.application.showSharePopup(element[0], content);

The HTML

Live Example