Embedding YouTube videos in dokuWiki

I am using dokuWiki – which is a great and simple open-source tool for maintaining documentation – for several of my projects and today I had a need to add YouTube video to a dokuWiki page. I could not find a way to do that in Google or at first sight also in dokuWiki documentation, but Andreas (the creator of dokuWiki) helped me out in comments to this post.

As per Andreas’ comment, dokuWiki in fact does have a built-in feature for embedding Youtube videos as well as other Flash objects and it is plain simple – add following code when editing a dokuWiki page:

{{http://www.youtube.com/v/RpQvPJZ1h70?.swf?400×333}}

Just replace the red part with your Youtube video code and there you go. Just make sure your dokuWiki version is up to date. As Andreas also explained, opening up the HTML code using the example below allows XSS vulnerabilities, therefore it is not recommended.

Earlier post:

First, I hopefully looked if dokuWiki might already have a built-in feature for that as it has been evolving rapidly, but sadly – no. Then, logically, I looked at dokuWiki plugins section. In there and in Google results I found 3 potential plugins that by their description might have been useful:

  • youtube plugin – the script itself points to a URL of a domain parking page, meaning – the domain had expired
  • youtubev2 plugin – says it has a XSS vulnerability and is not recommended for use
  • flash plugin – could not get it to work

I had an impression that dokuWiki community was already considerable, so I was a bit disappointed there was no plugin for such a simple task. Then googling around I found a reference to a similar solution not specifically for dokuWiki, BUT it did work for dokuWiki just fine:

To add Youtube video to a dokuWiki page, here is a code you simply must use when editing a dokuWiki page:

|<html><object width=”400″ height=”333″><param name=”movie”
value=”http://www.youtube.com/v/RpQvPJZ1h70“></param><param
name=”wmode” value=”transparent”></param><embed
src=”http://www.youtube.com/v/RpQvPJZ1h70
type=”application/x-shockwave-flash” wmode=”transparent” width=”400″
height=”333″></embed></object></html>|

Just change the Youtube video code (red part in code) to the one of your own video – please note that it differs from the actulal Youtube video URL. This code embeds the actual video in a wiki page instead of just adding a thumbnail or link to it. Aparently, this code structure might work for other needs of embedding other HTML objects in dokuWiki pages.

2 Comments so far

  1. Andreas Gohr on December 1st, 2010

    Opening HTML is opening XSS vulnerabilities, so you haven’t won anything. Better use the vshare plugin which will embed videos from nearly any videosharing site.

    If you just need YouTube, use DokuWiki’s ability to embed flash:

    {{http://www.youtube.com/v/RpQvPJZ1h70?.swf?400×333}}

  2. Prasad on August 22nd, 2013

    Thank you.. was searching out for a plugin.. But this is damn simple :) :)

Leave a Reply