UNC links

From MediaWiki.org
Jump to: navigation, search
Translate this page; This page contains changes which are not marked for translation.

Other languages:
العربية • ‎català • ‎Deutsch • ‎English • ‎español • ‎فارسی • ‎suomi • ‎français • ‎italiano • ‎日本語 • ‎polski • ‎português • ‎português do Brasil • ‎中文

The Universal Naming Convention, or UNC, specifies a common syntax to describe the location of a network resource, such as a shared file, directory, or printer. The UNC syntax for Windows systems is as follows:

\\ComputerName\Shared Folder\Resource Name

UNCs differ from URLs in that they do not have a protocol: prefix and that they can contain embedded spaces. In corporate use of MediaWiki, it is often useful to paste a UNC from Windows Explorer directly into a wiki page.

How to link[edit]

Description You type You get
UNC link, with title {{unc | \\ComputerName\Shared Folder\Resource Name | The resource}} The resource
UNC link, unnamed {{unc | \\ComputerName\Shared Folder\Resource Name}} [1]

Installation[edit]

Install the ParserFunctionsExtension:ParserFunctions extension. Follow installation instructions and add the optional "integrated string function functionality" line in LocalSettings.php by setting $wgPFEnableStringFunctions = true;. Install the extension StringFunctions (to enable #replace).

Add file:// to $wgUrlProtocols in LocalSettings.phpManual:LocalSettings.php:

array_push($wgUrlProtocols, "file://");

Create a template called Template:Unc (search for Template:Unc and click Create this page), and paste this text into the page content:

[file:///{{#replace:{{#replace:{{{1}}}| |%20}}|\|/}} {{#if:{{{2|}}}|{{{2}}}}}]

Browser compatibility[edit]

  • With Internet Explorer on Windows UNC Links work without exception.
    • A recent patch applied to both IE8 and IE9 now requires the Wiki site to be in the Intranet Sites list for this to work correctly.
  • For Google Chrome file:/// links are also disabled. They can be enabled using the LocalLinks extension.

See also[edit]

Wikipedia-logo.png Wikipedia: Path (computing)