Mediawiki Extension Iframe
Source: | DataSource |
---|---|
Language: | English |
Topic: | Mediawiki |
SubTopic: | Mediawiki Extension |
Last Edit By: | DochyJP |
LastEdit: | 2021-06-24 |
Document type: | Documentation |
Status: | Active |
Access: | free |
Copyright & security issues
Embedding external webpage into MediaWiki has two issues:
- Copyright violation: Embedding an external web page may violate copyrights. So, make sure that the domains that can be used in the extension are trusted!
- Security issue: External web pages may contain malicious code. Again make sure that the domains that can be used in the extension are trusted!
The extension uses keys to select web servers which are given by the wiki adminstrator during installation. Therefore, behind the key should only be trusted domains.
Known problems
The extension does not work properly with the MobileFrontend extension.
Installation
Clone the GIT repository
Go to the extensions directory and clone it from GitHub
git clone https://github.com/sigbertklinke/Iframe
Add to the bottom of LocalSettings.php
wfLoadExtension( 'Iframe' );
The global variable $wgIframe controls various aspects of the extensions, e.g. additional web adresses, delay of iframe loadings etc.
Adding other web addresses
If you want to add own keys/servers then add in LocalSettings.php after loading the extension
$wgIframe['server']['mykey'] = [ 'scheme' => 'https', 'domain' => 'mydomain' ];
This will allow you to use in wiki pages:
<iframe key="mykey" path="" />
Category
For easy finding of all wiki pages which have a <iframe ... /> inside, a category is added by
.
The name of the category can be controlled in LocalSettings.php by setting
$wgIframe['category'] = 'Iframe';
Notes:
The extension does NOT create the page Category:Iframe, that is left to the wiki administrator or user. If you create the page Category:Iframe then it might be useful to use hidden categories.
Width and height of an iframe
The default width and height of an iframe is 800x600 pixel. This can be set in LocalSettings.php via
$wgIframe['width'] = 640; $wgIframe['height'] = 400;
If no width and height is given then these defaults are used.
Delay of iframe loading
Usually a HTML document is shown if all parts of a document are loaded. If a iframe on a server, e.g. a Shiny server, triggers a lengthy computation then the document will appear only after all iframe(s) are loaded. Therefore a delay mechanism with JavaScript is included which starts the loading of the iframe(s) only after the document is ready. By $wgIframe['delay'] the delay is controlled:
If in LocalSettings.php
$wgIframe['delay'] = -1;
(or any negative value) is set then the iframe(s) will be loaded immediately, no delay will take place.
If in LocalSettings.php
$wgIframe['delay'] = 100;
(the default) is set then the first iframe will be loaded 100 ms after the document is loaded, the second 200 ms, and so on.