Search code examples
javascriptjquerygoogle-sites

JavaScript/jQuery limitations in Google Sites?


My client has a Google site and is requesting some jQuery/javascript functionality like lightboxes, etc. Can I assume I can tackle most generic jQuery/javascript features (By way of the gadgets API), or are there limitations I need to know about?

Thanks-


Solution

  • Wow I just googled Google Sites JQuery and the first page that came was a google FAQ answering your question.

    Can I use JQuery in Google sites?

    The most popular answer:

    Yes you can. Step by step : Add "safe html bypass" gadget to your site. Then in the properties section of the gadget, insert this html :

    <script type="text/javascript"  src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
    

    After that you can use jquery by adding more html elements and javascript. Example code :

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
    <input type="text" value="oerten" id="text" onclick="" />
    <input type="button" value="Click" id="but" onclick="var val=$('#text').attr('value');alert(val);" />
    <br />  
    
    Just paste this code snippet into the
    "HTML Code" section of the "safe html
    bypass" gadget. Save it and go
    

    Further Reading:

    How to add javascript or custom contents to google sites with gadget