Allow the player to browse shared content
browse(type, sort_order, label)

Browsing shared content

By using the browse function on the sharedContent property of the Kongregate API object, you can cause a list of shared content to appear in the user's browser. This will allow them to view, rate, or load shared content for your game. It accepts the following arguments:

NameTypeDescription
typeStringType of content to browse
sort_orderStringOptional parameter specifying how to sort the content
labelStringOptional label to filter the content with

The possible options for the sort_order parameter are listed below:

NameDescription
by_ownList the content created by the player first
by_newestNewest content first
by_load_countMost frequently loaded content first
by_friendsContent created by the player's friends first

Example: Loading shared content with Contraption as the content type

kongregate.sharedContent.addLoadListener("Contraption", onContraptionLoad);

function onContraptionLoad(params:Object):void {
  var id:Number        = params.id;
  var name:String      = params.name;
  var permalink:String = params.permalink;
  var content:String   = params.content;
  var label:String     = params.label;

  trace("Contraption " + id + " [" + label + "] loaded: " + content);
}
kongregate.sharedContent.addLoadListener("Contraption", onContraptionLoad);

function onContraptionLoad(params) {
  var id = params.id;
  var name = params.name;
  var permalink = params.permalink;
  var content = params.content;
  var label = params.label;

  console.log("Contraption " + id + " [" + label + "] loaded: " + content);
}

Example: Display a Shared Content browser for Contraptions, only showing those by your friends with the "Level 3 Solution" label

kongregate.sharedContent.browse("Contraption", "by_friends", "Level 3 Solution");
kongregate.sharedContent.browse("Contraption", "by_friends", "Level 3 Solution");

Related: