Table of Contents

iframe Plugin

Compatible with DokuWiki

  • 2024-02-06 "Kaos" unknown
  • 2023-04-04 "Jack Jackrum" unknown
  • 2022-07-31 "Igor" yes
  • 2020-07-29 "Hogfather" yes

plugin Allows external URLs to be loaded into an iframe in your DokuWiki page

Last updated on
2023-08-17
Provides
Syntax
Repository
Source

Similar to codebender

Tagged with embed, iframe, include

This plugin allows you to embed other web sites in a DokuWiki page using an iframe.

Download and Installation

Search and install the plugin using the Extension Manager. Refer to Plugins on how to install plugins manually.

Revision History

For more recent revisions please check github commit list

Manual Installation

To install the plugin manually, download the source to your plugin folder, lib/plugins and extract its contents. That will create a new plugin folder, lib/plugins/iframe, and install the plugin.

The folder will contain:

conf/default.php                       default settings
conf/metadata.php                      settings information for the config plugin
lang/xx/lang.php                       language strings for config plugin
syntax.php                             plugin script

Syntax and Usage

Simple:

{{url>http://www.example.com/somepage.html}}

Complete Syntax:

{{url>someurl width,height noscroll noborder alignment fullscreen|alternate-text}}

That is an URL to embed, followed by several optional parameters. The following parameters are recognized:

See the plugin in action here.

Configuration

The plugin has one configuration setting, which can be set via the admin/configuration settings page.

:!: This should never be enabled in public wikis as it opens a XSS security hole.

Acknowledgments

The plugin was created in response to an idea mentioned by Styno.

This plugin was used as a basis for google_cal by Kite

Known Problems

Mixed Content (HTTPS vs. HTTP)

Modern web browsers will by default NOT embed stuff from “HTTP-only” sources in an HTTPS environment1) - browsers will show dialogs on top or bottom of the page's window (noted for IE and SeaMonkey) or a symbol at the beginning (Firefox) or the end (Chrome) of the URL bar, allowing situative or general settings for “mixed content”. :-D Should be no problem if you keep your site consistent (use relative url paths for local sources), but may be confusing in test cases.

Discussion

This used to be the right spot for this, but maybe not these days?

First a big thanks to Christopher for this plugins, it's because I want to use it a lot more in my newest wiki that I took the time to figure out why it was broken(it's not).

Some one (like me) upgrading their DokuWiki from the 2008-05-05 release using the older release of this plugin (2006-12-17) will think its broken.

I know I did, but after studying the source code and doing some experiments I realized what is really wrong is that the syntax changed, (a lot) between then and now. The old 2006 release requires brackets for its arguments, the 2008 release chokes on brackets and creates bad URL's. I suspect this is well known to people who follow the forums, but a surprise to those like me who simply visit the plugin pages every few years. To fix simply change your pages that use this plugin from using brackets to using a leading space and all will be well. Examples (all url's point to a private, off Internet server):

Iframe release
year
Example valid usage
2006-12-17 {{url>http://asimov/DokuWiki/[80%,400px]|iFrame not installed}} OLD SYNTAX
2008-10-31 {{url>http://asimov/DokuWiki/ 80%,400px|iFrame not installed}} NEW SYNTAX
2008-10-31 {{url>http://asimov/DokuWiki/|iFrame not installed}}
2006-12-17 {{url>http://asimov/DokuWiki/|iFrame not installed}}

Notice how if no arguments are given, then the same syntax works fine for both releases. Perhaps this is why this plugin is tagged as 'broken' by some? Also keep in mind the original 2006 release only supported frame width, height. New version supports floats, and invisible borders. (which I think is really cool)

Regardless, it's a great plugin, thank you Christopher Smith for your work then and now.

PS. Yes I know doc above says the same thing, but sometimes you have to hit people over the head before they listen.

Tip to use together with survey-tool

The iFrame is a great means to link your Wiki to for example Survey-tools like SurveyGizmo. In wiki's with registered users you can even use the username as a key to string together the two environments, by using the value of @USER@ as URL parameter sguid. The result is great, persistent dynamic content in the iFrame specific for the current user.

To achieve this, a very small addition to iFrame is needed so that it accepts @USER@ as a variable. In syntax.php, line 96 simply replace:

'src'   => $data['url'], 

with

'src'   => str_replace('@USER@', $_SERVER['REMOTE_USER'], $data['url']), 

That's all.

Independent from this: A useful extension of this plugin to avoid security problems would be, to restrict the possible URL's through a list in the configuration.

Harald 2014/03/22 11:53

Original size

I want to include an url with its current width and height. But I don't find any possibility to set parameters for this purpose.

Juergen 2014/06/25 10:35

Unfortunately its not something that browsers support. Due to modern browser security models, its also not possible with javascript in most circumstances. — ChrisS 2015-07-31 19:12
1)
older browsers may just inform the user about mixed content, but will mix it