Click here to Skip to main content
Licence CPOL
First Posted 12 Feb 2011
Views 3,658
Bookmarked 1 time

How to load JQuery to a page of an Office Live website

By | 12 Feb 2011 | Technical Blog
How to load JQuery to a page of an Office Live website
A Technical Blog article. View original blog here.[^]

Office Live provides users with a decent page designer to create a website. There is often the need to customize the web pages with more rich content, and you may be limited to what the designer can do. Office Live uses SharePoint and ASPX (.NET) for the creation of the websites, but we can only upload markup pages with no code behind. Nevertheless, this constraint can be overcome by manipulating the UI from the client end. For those cases, we can use a bit of programming ability, and with the use of a JavaScript framework, we can make any plain website look and behave a lot better.

This is where jQuery comes in to help us. jQuery is a JavaScript framework which can be used to manipulate the DOM on the client, make AJAX calls to other pages and/or websites (keep in mind the cross domain issues). To use this framework, we first need to figure out where to get the file and how to download it to the page.

You can visit http://docs.jquery.com/Downloading_jQuery and get a link to a CDN (Content Delivery Network). In this case, you could use the Microsoft CDN. Make sure to copy the link. In the case that you want to save a copy of the file in your website, you can get the latest version of jQuery from jquery.com. Visit the website and look for "Grab the Latest Version" header. Select the production checkbox, click on the download button and save to your computer. This should save the minimized (no spaces, no comments, lighter in size) version of the File. Once you have the copy on your workstation, you can login to your Office Live administration website and upload the file to your document gallery.

We are now ready to add jQuery to our website, and we can do this with the help of a module. Login to the Administration site and select website design. On the page editor, follow these steps:

  1. Select the page that needs to be modified
  2. Select module
  3. Select custom footer (NOT the HTML modules because it uses an IFrame and timer to load the HTML)

On the dialog, delete everything and add the following:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="html" />
    <xsl:template match="/Footer">
        <script type="text/javascript" 
	src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.min.js"></script>  
    </xsl:template>
</xsl:stylesheet>

If you decided to use your document gallery to host the file, you should replace the Microsoft URL (bold letters) with this:

<script type="text/javascript" 
	src="http://www.codeproject.com/documents/jquery-1.4.2.min.js"></script>

Press OK and save the page. You can now load the page and do a view source. You will see that the reference to jQuery is now present on the page. Now that framework is available to your page, we now need to add the customization script. The framework does not do anything on its own. There is the need for a custom script which will be used to manipulate the web page. This is part of a different blog which I will be providing soon.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

ozkar garcia

Software Developer (Senior)
0G-BITechnologies
United States United States

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
-- There are no messages in this forum --
Permalink | Advertise | Privacy | Mobile
Web03 | 2.5.120517.1 | Last Updated 13 Feb 2011
Article Copyright 2011 by ozkar garcia
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid