{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","settings":"","params":[],"results":{"codes":[]}},"next":{"description":"","pages":[]},"title":"Install","type":"basic","slug":"platformjs","excerpt":"Embedly's JavaScript library","body":"``plaform.js`` is Embedly's JavaScript library for creating cards, buttons, modals and interacting with the player apis.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Install\"\n}\n[/block]\nThere are multiple ways to install ``platform.js`` into your page, here is the preferred method. Copy and paste the following code to the ``<body>`` of your document.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<script>\\n  (function(w, d){\\n   var id='embedly-platform', n = 'script';\\n   if (!d.getElementById(id)){\\n     w.embedly = w.embedly || function() {(w.embedly.q = w.embedly.q || []).push(arguments);};\\n     var e = d.createElement(n); e.id = id; e.async=1;\\n     e.src = ('https:' === document.location.protocol ? 'https' : 'http') + '://cdn.embedly.com/widgets/platform.js';\\n     var s = d.getElementsByTagName(n)[0];\\n     s.parentNode.insertBefore(e, s);\\n   }\\n  })(window, document);\\n</script>\",\n      \"language\": \"html\"\n    }\n  ]\n}\n[/block]\nThis allows embedly to install ``platform.js`` javascript in an async manner, but still queue requests immediately.\n\nIf you will not be integrating the the ``embedly`` global object then you can also use:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<script async src=\\\"//cdn.embedly.com/widgets/platform.js\\\" charset=\\\"UTF-8\\\"></script>\",\n      \"language\": \"html\"\n    }\n  ]\n}\n[/block]","updates":["5ccf5ec685febc001468fd72","5ccf6111f79db00057a2dd55"],"order":0,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"564e0e5ea910003500a0ca38","parentDoc":null,"version":{"version":"1.0","version_clean":"1.0.0","codename":"","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["564de2ddfe07a81700b5c3a9","564df317826645210097a890","564df3217c8f372b00b934df","564e5227c3553e0d003e53ba","5666dac5d784a70d00397bcb","56cd08ddd98d851d00c0c3bd","56e9a50946bfd60e008840a7","5718e37bf8f7de1900683fad","58c3308dfedf070f0043b72c","58ce99c75457d02300560c0a"],"_id":"564de2dbfe07a81700b5c3a8","project":"564de2dbfe07a81700b5c3a5","__v":10,"createdAt":"2015-11-19T14:55:23.838Z","releaseDate":"2015-11-19T14:55:23.837Z"},"project":"564de2dbfe07a81700b5c3a5","user":"564de2b4fe07a81700b5c3a4","category":{"sync":{"isSync":false,"url":""},"pages":["564e0de843817f17002a5ecc","564e0e5ea910003500a0ca38","564e19e3bc4e172d00b9534e","56f168612a85600e00ea3dcb","56f17465dbe4cc1700a66a7a"],"title":"JavaScript","slug":"javascript","order":2,"from_sync":false,"reference":false,"_id":"564df317826645210097a890","project":"564de2dbfe07a81700b5c3a5","__v":5,"createdAt":"2015-11-19T16:04:39.832Z","version":"564de2dbfe07a81700b5c3a8"},"createdAt":"2015-11-19T18:01:02.366Z","githubsync":"","__v":10}

Install

Embedly's JavaScript library

``plaform.js`` is Embedly's JavaScript library for creating cards, buttons, modals and interacting with the player apis. [block:api-header] { "type": "basic", "title": "Install" } [/block] There are multiple ways to install ``platform.js`` into your page, here is the preferred method. Copy and paste the following code to the ``<body>`` of your document. [block:code] { "codes": [ { "code": "<script>\n (function(w, d){\n var id='embedly-platform', n = 'script';\n if (!d.getElementById(id)){\n w.embedly = w.embedly || function() {(w.embedly.q = w.embedly.q || []).push(arguments);};\n var e = d.createElement(n); e.id = id; e.async=1;\n e.src = ('https:' === document.location.protocol ? 'https' : 'http') + '://cdn.embedly.com/widgets/platform.js';\n var s = d.getElementsByTagName(n)[0];\n s.parentNode.insertBefore(e, s);\n }\n })(window, document);\n</script>", "language": "html" } ] } [/block] This allows embedly to install ``platform.js`` javascript in an async manner, but still queue requests immediately. If you will not be integrating the the ``embedly`` global object then you can also use: [block:code] { "codes": [ { "code": "<script async src=\"//cdn.embedly.com/widgets/platform.js\" charset=\"UTF-8\"></script>", "language": "html" } ] } [/block]