Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Casey Ydenberg
Casey Ydenberg
15,622 Points

Using external JavaScript libraries in a blog

Hi,

I'm going to create a blog to showcase some of the things developers are doing with HTML5 Canvas. My idea is that each post would cover a different use of Canvas, whether for data visualization, animations, games or whatever.

I was wondering if it's at all possible to include the canvas elements in the blog. Since this showcases other people's work, this would potentially require a different JS library associated with each post, either downloaded from GitHub or linked externally with the site-owner's permission.

My questions are:

  • Would different libraries conflict with each other on the main page?
  • Is there any risk of XSS attacks, if I'm the sole author? How do I watch out for it?
  • Any additional thoughts you have about this.

Thanks! Casey

1 Answer

Casey,

There would be a potential conflict if one of the libraries included in a page overlapped a library you already used, but otherwise you should be ok.

A simple solution might be to use a lightbox/etc to link directly to a demonstration page for each element so you can isolate the pages.