{"__v":2,"_id":"570fb733b85a841900aa95b2","category":{"project":"56abbf55f25f160d00e17f4e","version":"56abbf55f25f160d00e17f51","_id":"570a5676ade45d0e00c1ad33","__v":0,"sync":{"url":"","isSync":false},"reference":true,"createdAt":"2016-04-10T13:34:46.864Z","from_sync":false,"order":3,"slug":"client-side-api","title":"Client Side API"},"parentDoc":null,"project":"56abbf55f25f160d00e17f4e","user":"56abbec30b9e0b0d00616274","version":{"__v":12,"_id":"56abbf55f25f160d00e17f51","project":"56abbf55f25f160d00e17f4e","createdAt":"2016-01-29T19:36:53.665Z","releaseDate":"2016-01-29T19:36:53.665Z","categories":["56abbf56f25f160d00e17f52","56abca6bf9757e0d007c6650","56acddfa0ab3c00d00ce3332","56af65da9d32e30d0006d30f","56af66cab34d210d003d9ad0","56af6afcd21e9c0d00b628d1","56af6d6ecc4cbd0d00ce2c88","5705b12221cfed0e00e8c580","570a5676ade45d0e00c1ad33","570d7d25d1e4b82000d9e385","570eac3c3160d10e0041df0e","575709000fd6a3200010dded"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-04-14T15:28:51.311Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":true,"order":27,"body":"## Browsing shared content\n\nBy 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:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"`type`\",\n    \"0-1\": \"String\",\n    \"0-2\": \"Type of content to browse\",\n    \"1-0\": \"`sort_order`\",\n    \"1-1\": \"String\",\n    \"1-2\": \"Optional parameter specifying how to sort the content\",\n    \"2-0\": \"`label`\",\n    \"2-1\": \"String\",\n    \"2-2\": \"Optional label to filter the content with\"\n  },\n  \"cols\": 3,\n  \"rows\": 3\n}\n[/block]\nThe possible options for the `sort_order` parameter are listed below:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"`by_own`\",\n    \"0-1\": \"List the content created by the player first\",\n    \"0-2\": \"Unique ID of the created shared content\",\n    \"1-0\": \"`by_newest`\",\n    \"1-1\": \"Newest content first\",\n    \"1-2\": \"Name of the shared content\",\n    \"2-0\": \"`by_load_count`\",\n    \"2-1\": \"Most frequently loaded content first\",\n    \"2-2\": \"Link to the shared content\",\n    \"3-0\": \"`by_friends`\",\n    \"3-1\": \"Content created by the player's friends first\",\n    \"3-2\": \"The content itself\"\n  },\n  \"cols\": 2,\n  \"rows\": 4\n}\n[/block]\n**Example:** Loading shared content with `Contraption` as the content type\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"kongregate.sharedContent.addLoadListener(\\\"Contraption\\\", onContraptionLoad);\\n\\nfunction onContraptionLoad(params:Object):void {\\n  var id:Number        = params.id;\\n  var name:String      = params.name;\\n  var permalink:String = params.permalink;\\n  var content:String   = params.content;\\n  var label:String     = params.label;\\n\\n  trace(\\\"Contraption \\\" + id + \\\" [\\\" + label + \\\"] loaded: \\\" + content);\\n}\",\n      \"language\": \"javascript\",\n      \"name\": \"ActionScript 3\"\n    },\n    {\n      \"code\": \"kongregate.sharedContent.addLoadListener(\\\"Contraption\\\", onContraptionLoad);\\n\\nfunction onContraptionLoad(params) {\\n  var id = params.id;\\n  var name = params.name;\\n  var permalink = params.permalink;\\n  var content = params.content;\\n  var label = params.label;\\n\\n  console.log(\\\"Contraption \\\" + id + \\\" [\\\" + label + \\\"] loaded: \\\" + content);\\n}\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n**Example:** Display a Shared Content browser for `Contraptions`, only showing those by your friends with the \"Level 3 Solution\" label\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"kongregate.sharedContent.browse(\\\"Contraption\\\", \\\"by_friends\\\", \\\"Level 3 Solution\\\");\",\n      \"language\": \"javascript\",\n      \"name\": \"ActionScript 3\"\n    },\n    {\n      \"code\": \"kongregate.sharedContent.browse(\\\"Contraption\\\", \\\"by_friends\\\", \\\"Level 3 Solution\\\");\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nRelated:\n\n* [SharedContent.Save](doc:client-api-sharedcontent-save) \n* [SharedContent.AddLoadListener](doc:client-api-sharedcontent-addloadlistener)","excerpt":"Allow the player to browse shared content\n`browse(type, sort_order, label)`","slug":"sharedcontentbrowse","type":"fn","title":"SharedContent.Browse"}

SharedContent.Browse

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: [block:parameters] { "data": { "h-0": "Name", "h-1": "Type", "h-2": "Description", "0-0": "`type`", "0-1": "String", "0-2": "Type of content to browse", "1-0": "`sort_order`", "1-1": "String", "1-2": "Optional parameter specifying how to sort the content", "2-0": "`label`", "2-1": "String", "2-2": "Optional label to filter the content with" }, "cols": 3, "rows": 3 } [/block] The possible options for the `sort_order` parameter are listed below: [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "h-2": "Description", "0-0": "`by_own`", "0-1": "List the content created by the player first", "0-2": "Unique ID of the created shared content", "1-0": "`by_newest`", "1-1": "Newest content first", "1-2": "Name of the shared content", "2-0": "`by_load_count`", "2-1": "Most frequently loaded content first", "2-2": "Link to the shared content", "3-0": "`by_friends`", "3-1": "Content created by the player's friends first", "3-2": "The content itself" }, "cols": 2, "rows": 4 } [/block] **Example:** Loading shared content with `Contraption` as the content type [block:code] { "codes": [ { "code": "kongregate.sharedContent.addLoadListener(\"Contraption\", onContraptionLoad);\n\nfunction onContraptionLoad(params:Object):void {\n var id:Number = params.id;\n var name:String = params.name;\n var permalink:String = params.permalink;\n var content:String = params.content;\n var label:String = params.label;\n\n trace(\"Contraption \" + id + \" [\" + label + \"] loaded: \" + content);\n}", "language": "javascript", "name": "ActionScript 3" }, { "code": "kongregate.sharedContent.addLoadListener(\"Contraption\", onContraptionLoad);\n\nfunction onContraptionLoad(params) {\n var id = params.id;\n var name = params.name;\n var permalink = params.permalink;\n var content = params.content;\n var label = params.label;\n\n console.log(\"Contraption \" + id + \" [\" + label + \"] loaded: \" + content);\n}", "language": "javascript" } ] } [/block] **Example:** Display a Shared Content browser for `Contraptions`, only showing those by your friends with the "Level 3 Solution" label [block:code] { "codes": [ { "code": "kongregate.sharedContent.browse(\"Contraption\", \"by_friends\", \"Level 3 Solution\");", "language": "javascript", "name": "ActionScript 3" }, { "code": "kongregate.sharedContent.browse(\"Contraption\", \"by_friends\", \"Level 3 Solution\");", "language": "javascript" } ] } [/block] Related: * [SharedContent.Save](doc:client-api-sharedcontent-save) * [SharedContent.AddLoadListener](doc:client-api-sharedcontent-addloadlistener)