Embedding YouTube Videos
...as well as other dangerous active content
Filed under End-User
Return to the index.
HTML Purifier End-User Documentation
Clients like their YouTube videos. It gives them a warm fuzzy feeling when they see a neat little embedded video player on their websites that can play the latest clips from their documentary "Fido and the Bones of Spring". All joking aside, the ability to embed YouTube videos or other active content in their pages is something that a lot of people like.
This is a bad idea. The moment you embed anything untrusted, you will definitely be slammed by a manner of nasties that can be embedded in things from your run of the mill Flash movie to Quicktime movies. Even img tags, which HTML Purifier allows by default, can be dangerous. Be distrustful of anything that tells a browser to load content from another website automatically.
Luckily for us, however, whitelisting saves the day. Sure, letting users include any old random flash file could be dangerous, but if it's from a specific website, it probably is okay. If no amount of pleading will convince the people upstairs that they should just settle with just linking to their movies, you may find this technique very useful.
Looking in
Below is custom code that allows users to embed YouTube videos. This is not favoritism: this trick can easily be adapted for other forms of embeddable content.
Usually, websites like YouTube give us boilerplate code that you can insert into your documents. YouTube's code goes like this:
0 komentar:
Posting Komentar