Download and host JavaScript files

Sometimes it is faster and more reliable to store JavaScript files on your own server, usually same place as website itself. This also allows web developers to edit JavaScript files directly and make changes on the fly.

For this purpose we have created an option to download your generated JavaScript files, edit them and host it on your servers.

How to download a JavaScript file?

You can download JS file from your account page by clicking “Download” button next to a proper cookie script item.

download-menu

Editable JS file – should be used if you want to edit file yourself before putting it on your website. It is written in a readable way, so a web developer could add necessary changes.

Minified JS file – should be used if you are not going to add any changes. This file takes slightly less space so it can be read by visitors faster.

Choose a proper file and it will start downloading:

download

How to upload a file to your server?

You can upload file to any folder on your website or to a root of web directory. This can be done using FTP client or any other method you use to upload files.

How to use file on your website?

Once you upload file to your server, you can include it on your website. You can include JS file in header or just before closing </body> tag. Here is an example of how to include JavaScript files to your website:

<script type="text/javascript" src="/903e0d0491c903e0d0491c903e0d0491c.js"></script>

If file is placed in root website directory. Change file name to the one you have uploaded. Or:

<script type="text/javascript" src="/includes/903e0d0491c903e0d0491c903e0d0491c.js"></script>

If file is placed in “includes” directory.

You can change file name to your own if you need.

Note that if you decide to download and host JavaScript file yourself, it can’t be updated automatically by cookie-script anymore. This means that no changes to cookie script item (ex. pop-up title, description or custom colors) will take effect by itself. In order to apply new changes, you have to re-download JavaScript file and re-upload it on your server.