Extension:LaunchExternal

From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
Crystal Clear action run.svg
LaunchExternal
Release status: stable
Implementation Parser extension
Description Uploaded 'media/images/http:/file:/etc links open in new external window
Author(s) Eric Fortin
Latest version 1.1 (2/13/2009)
License GPL
Download download
Translate the LaunchExternal extension if it is available at translatewiki.net
Check usage and version matrix.

Allows wiki author to choose to open existing media, images or a "://" type link into a new external window. An http reference must be in the correct fully named web format (http://www.google.com) or you'll get a 'bad reference' error. You'll get the same error if a local media file match isn't found as well.


This extension should be able to open any type of documents that can normally be opened with the installed web browser. I've personally tested Powerpoint, Word and Excel for Office 2003. It also works well with Adobe PDF files.

Note: With Powerpoint, I've noticed in my testing, that the Powerpoint process is still running even after you close the browser window... not sure if this is a standard issue with running Powerpoint in a browser window or if its my WinXP configuration.


Syntax Examples[edit]

<ext>Holiday_calendar.doc</ext>
<ext>Holiday_calendar.doc ::Paid Holidays</ext>
<ext>http://www.google.com</ext>

<ext>file://\\sharedserver\Holiday_calendar.doc</ext>
<ext>file://sharedserver/Holiday_calendar.doc</ext>
<ext>file:\\sharedserver\Holiday_calendar.doc</ext>

<ext>www.cnn.com</ext> <-- bad reference/missing "http://"

Installation[edit]

require_once("$IP/extensions/LaunchExternal/launchExternal.php");

To automatically attach a servername description to the link...

$wgAddServerName_EXT = true;

<ext>file:\\sharedserver\Holiday_calendar.doc</ext>
Holiday_calendar.doc (sharedserver)

Recommended Script for "outside links only..."[edit]

This script, if added into either the 'Mediawiki:Common.js' or 'User:Common.js' forces all external links to open in a new window. The extension above opens uploaded media/images into a new window (this script doesn't). For http type links, you can either use this script or the above extension.

(function($) {
    var externalLinks = function() {
        $("a.external,a[rel=nofollow],#footer-icons a,#footer-info-copyright a,#f-copyrightico a,#f-poweredbyico a").attr('target', '_blank');
    };
    $(externalLinks);
})(jQuery);

My Other Extensions[edit]

Current MediaWiki Projects

Extension:Calendar (Kenyu73) -- wikipage calendar
Extension:MW Calendar -- database calendar
Extension:LaunchExternal
Extension:Presentation
Extension:Tabber
Extension:Menu

Later MediaWiki release compatibility issues mitigation.

Scott Guthrie 10/25/2016 rscottguthrie@gmail.com

UPDATE to source code for more current MediaWiki releases.

Here are 2 changes identified for 'launchExtension.php'.

LINE 28

// fix for deprecated 'split'

$arrInput = split("::",$input);       // use a different display then the file reference...

$arrInput = explode("::",$input);       // use a different display then the file reference...

LINE 56

// fix for missing 'Image' class

$img = Image::newFromName( $reference );

    if( $img ->exists() )

$img = wfFindFile($reference);

if(is_object($img))