{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"never","settings":"","params":[],"results":{"codes":[]}},"next":{"description":"","pages":[]},"title":"Introduction","type":"basic","slug":"rollmyfile-js-api","excerpt":"This page will help you get started with rollMyFile JavaScript API to open hundreds of different file types on the Web.","body":"# Using rollMyFile API in JavaScript\n\nOn a page, where you want to let users open files, you simply do the following\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<script type=\\\"text/javascript\\\" src=\\\"https://api.rollapp.com/2/js/rollmyfile.js\\\"></script>\\n\\n<script type=\\\"text/javascript\\\">\\n    var key = \\\"SeCur3AP1K3y\\\";\\n\\n    var rollMyFile = new RollMyFile(key);\\n</script>\",\n      \"language\": \"html\"\n    }\n  ]\n}\n[/block]\nAnd then all it takes to open a file is \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"rollMyFile.openFileByUrl(\\\"https://www.example.com/documentation/overview.docx\\\");\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]","updates":["57e3313b4d659c0e0006e8d2"],"order":0,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"5ca0d9153101e9005122599d","githubsync":"","project":"54523fec04160008005b1cc8","__v":2,"version":{"version":"3.0","version_clean":"3.0.0","codename":"","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["5ca0d9153101e9005122599a","5ca0d9153101e9005122599b","5ca0d9153101e9005122599c"],"_id":"5ca0d9153101e900512259aa","project":"54523fec04160008005b1cc8","__v":0,"forked_from":"57b557f0d3092517007cfac3","createdAt":"2016-08-18T06:38:40.018Z","releaseDate":"2016-08-18T06:38:40.018Z"},"createdAt":"2014-10-30T13:41:00.558Z","category":{"sync":{"isSync":false,"url":""},"pages":[],"title":"rollMyFile JavaScript API","slug":"rollmyfile-javascript-api","order":0,"from_sync":false,"reference":false,"_id":"5ca0d9153101e9005122599a","project":"54523fec04160008005b1cc8","createdAt":"2014-11-13T07:05:09.147Z","__v":0,"version":"5ca0d9153101e900512259aa"},"user":"54523f0604160008005b1cc0","parentDoc":null}

Introduction

This page will help you get started with rollMyFile JavaScript API to open hundreds of different file types on the Web.

# Using rollMyFile API in JavaScript On a page, where you want to let users open files, you simply do the following [block:code] { "codes": [ { "code": "<script type=\"text/javascript\" src=\"https://api.rollapp.com/2/js/rollmyfile.js\"></script>\n\n<script type=\"text/javascript\">\n var key = \"SeCur3AP1K3y\";\n\n var rollMyFile = new RollMyFile(key);\n</script>", "language": "html" } ] } [/block] And then all it takes to open a file is [block:code] { "codes": [ { "code": "rollMyFile.openFileByUrl(\"https://www.example.com/documentation/overview.docx\");", "language": "javascript" } ] } [/block]