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 blogspot.com.
  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: http://ex-ample.yolasite.com/js.php
    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:
    http://ex-ample.blogspot.com/2011/06/small-content-manager-service-of-google.html
    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:
    http://ex-ample.blogspot.com/2011/06/small-content-manager-service-of-google.html
    http://ex-ample.yolasite.com/g-sites.php

    2-2) with a web hosting service. YOLA.com: I like yola.com 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:
    http://ex-ample.yolasite.com/js.php
    http://ex-ample.blogspot.com/2011/06/comparison-of-web-hosting-services.html

    2-3) with a content management service.box.net for the free service, the name of your file changes: http://www.box.net/shared/jo50kyvsqqc0595zkg4o...
     it is not good at all (also ADrive.com, 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: http://ex-ample.yolasite.com/js-notag.php
    (see the difference with no external file:
    http://ex-ample.yolasite.com/js.php)
    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 http://ex-ample.yolasite.com/g-sites.php
    see also the content management service of sites.google :
    http://ex-ample.blogspot.com/2011/06/small-content-manager-service-of-google.html

  4. The help forum's threads below discussed the .js files and bloger and google sites:
    http://www.google.com/support/forum/p/sites/thread?tid=4460cf8b5c19140f&hl=en
    http://www.google.com/support/forum/p/blogger/thread?tid=1b952fb331bb604b&hl=en&fid=1b952fb331bb604b000475c1dcac4618
    see also: http://www.bloggersentral.com/2010/03/where-to-host-javascript-for-blogspot.html

  5. more info on content management services:



2 comments:

  1. This blog aware me about different programs which can become very useful for our friends and kids. Few websites provide combined courses and few of the are separately for single subject. Glad to get this หนังตลก

    ReplyDelete
  2. On-line audio promoting is gaining popularity by the day. Web entrepreneurs have realized that utilizing audio can drastically improve conversion charges. You'll have seen that a big majority of gross sales pages (significantly regarding info merchandise) make the most of audio and/or video. That is no coincidence. If you want to learn more about this topic, then please visit onlineconvertfree.com

    ReplyDelete