{"__v":8,"_id":"564e0e5ea910003500a0ca38","category":{"__v":5,"_id":"564df317826645210097a890","pages":["564e0de843817f17002a5ecc","564e0e5ea910003500a0ca38","564e19e3bc4e172d00b9534e","56f168612a85600e00ea3dcb","56f17465dbe4cc1700a66a7a"],"project":"564de2dbfe07a81700b5c3a5","version":"564de2dbfe07a81700b5c3a8","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-11-19T16:04:39.832Z","from_sync":false,"order":1,"slug":"javascript","title":"JavaScript"},"parentDoc":null,"project":"564de2dbfe07a81700b5c3a5","user":"564de2b4fe07a81700b5c3a4","version":{"__v":8,"_id":"564de2dbfe07a81700b5c3a8","project":"564de2dbfe07a81700b5c3a5","createdAt":"2015-11-19T14:55:23.838Z","releaseDate":"2015-11-19T14:55:23.837Z","categories":["564de2ddfe07a81700b5c3a9","564df317826645210097a890","564df3217c8f372b00b934df","564e5227c3553e0d003e53ba","5666dac5d784a70d00397bcb","56cd08ddd98d851d00c0c3bd","56e9a50946bfd60e008840a7","5718e37bf8f7de1900683fad"],"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":"2015-11-19T18:01:02.366Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"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]","excerpt":"Embedly's JavaScript library","slug":"platformjs","type":"basic","title":"Install"}

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]