Sometimes I have to put text on a path

Thursday, June 23, 2011

Where to host Javascript for blogger blogs?


Blogger does not provide file hosting (except for photos and videos, in fact in Picasaweb, and templates).
This poses problem if you want to add a widget or a feature that uses Javascript (with one or many files).
Where do you put the scripts then?
Below are 3 options you have when adding Javascripts to your
  1. Put it in the HTML/javascript blogger gadget (or in your template). If the script is small and used only for that particular gadget/widget then this is the best method. Select this method because it’s easier to install, uninstall, no links, etc.
    See the left-sidebar of this blog for some examples (see "no external js").
    See also:
    If the script is accessed from outside of a widget/gadget or from more than one places in your template, put it in your template. But if you change your template without copying this modification, your code will be broken. Not safe method.
  2. Host the javascript file outside of Blogger server with a content managements service or a web hosting service.
    2-1) with a web hosting service. GOOGLE.SITES: You can select the google free web hosting service : "Google Sites" (Site storage only 100MB).
    GoogleSites has a little content management service:
    And Google Sites doesn’t accept js files.

      a)But a .js file is in fact a .txt file then change the javascript file into a text file, by changing the file extension from .js to .txt, (and add-js_ before .txt)  then your filename is CODE-js_.txt.

      b) The external script must not contain the script tags (no HTML tags). After uploading the file to Google Sites, get the link to the file and use it in the code (the link to the file will begin with https) and to make it work, you need to change https to http when adding to the code:

    2-2) with a web hosting service. I like but you cannot upload a .js file but you can use the same trick (.txt). Moreover you can immediately test your code with the script tags:

    2-3) with a content management for the free service, the name of your file changes:
     it is not good at all (also, etc...). See point 5 below.

  3. Yola has also a small, efficient and simple content management service. This service is sufficient (and stockage = 1GB) and you can immediately test the code:
    (see the difference with no external file:
    Then you can easily develop your javascript with yola.

    But many persons think that you cannot use these external files in your blogger blog... (see the links, point 4 below). It seems that it was a decision of google: "for abuse prevention measures" (message @ 2009)... I try and it works : see the left side-bar of this blog.

    The ".js to .txt hack" should work equally well in both Blogger  or google sites custom domain.
    see also the content management service of :

  4. The help forum's threads below discussed the .js files and bloger and google sites:
    see also:

  5. more info on content management services:

1 comment:

  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer learn from Javascript Online Training from India . or learn thru JavaScript Online Training from India. Nowadays JavaScript has tons of job opportunities on various vertical industry. ES6 Training in Chennai