What is MIME type "text/uri-list"?
A MIME type is a string that tells browsers and other tools how to handle a particular kind of file.
The MIME type text/uri-list is a plain-text format used to store one or more URIs as a list. Each line holds a single URI. Lines starting with # are comments and ignored.
It is used to transfer sets of links between applications. This makes it useful in drag and drop operations and for batch processing of URLs.
- Link Sharing: It allows programs to share multiple resource links in one file.
- Interoperability: Desktop environments, file managers, and browsers use it to exchange links seamlessly.
- Automation: Scripts can easily parse the plain text to process files, initiate downloads, or open multiple web resources at once.
Files using this MIME type commonly have names ending in URI, URIS, or URLS.
For further details, visit the IANA registry for text/uri-list.
Associated file extensions
Usage Examples
HTTP Header
When serving content with this MIME type, set the Content-Type header:
Content-Type: text/uri-list
HTML
In HTML, you can specify the MIME type in various elements:
<a href="file.dat" type="text/uri-list">Download file</a>
Server-side (Node.js)
Setting the Content-Type header in Node.js:
const http = require('http');
http.createServer((req, res) => {
res.setHeader('Content-Type', 'text/uri-list');
res.end('Content here');
}).listen(3000);
Associated file extensions
FAQs
What is the correct file structure for text/uri-list?
A valid text/uri-list file is a plain text document where each line contains exactly one URI. Lines beginning with the # character are treated as comments and ignored. While the standard specifies CRLF line endings, many parsers also accept standard LF endings.
How is text/uri-list used in web browsers?
Browsers primarily use this MIME type for drag-and-drop interactions. When you drag a link or an image from a web page to another application (like a file manager or text editor), the browser creates a data transfer object containing the URL in text/uri-list format.
How do I configure Apache or Nginx to serve .uri files?
For Apache, add AddType text/uri-list .uri .urls to your configuration or .htaccess file. For Nginx, add the line text/uri-list uri urls; inside your mime.types file or the types { ... } block to ensure the correct headers are sent.
Is text/uri-list the same as a Windows .URL shortcut?
No, they are different formats. A Windows shortcut (often application/internet-shortcut) uses an INI-style structure starting with [InternetShortcut]. In contrast, text/uri-list is a raw list of URIs often associated with .uri files, making it more cross-platform compatible.
How do I parse a text/uri-list file in Python?
You can read the file line-by-line and filter out comments. A simple approach is to iterate through the file object, stripping whitespace, and ignoring lines that start with #. This allows you to extract valid links for automation or batch downloading.
Can I edit a text/uri-list file with a standard text editor?
Yes, because the underlying format is plain text, you can open and edit these files with Notepad, TextEdit, or VS Code. Simply ensure you save the file with the correct encoding (usually UTF-8 or ASCII) and the appropriate extension, such as .uris.
Are there security risks associated with text/uri-list?
The file format itself is safe, but the content consists of links which may lead to malicious sites. When writing software that parses these lists, developers should validate the protocol (e.g., ensuring links are http or https rather than local file:// paths) to prevent unauthorized local file access.
General FAQ
What is a MIME type?
A MIME (Multipurpose Internet Mail Extensions) type is a standard that indicates the nature and format of a document, file, or assortment of bytes. MIME types are defined and standardized in IETF's RFC 6838.
MIME types are important because they help browsers and servers understand how to process a file. When a browser receives a file from a server, it uses the MIME type to determine how to display or handle the content, whether it's an image to display, a PDF to open in a viewer, or a video to play.
MIME types consist of a type and a subtype, separated by a slash (e.g., text/html, image/jpeg, application/pdf). Some MIME types also include optional parameters.
How do I find the MIME type for a file?
You can check the file extension or use a file identification tool such as file --mime-type on the command line. Many programming languages also provide libraries to detect MIME types.
Why are multiple MIME types listed for one extension?
Different applications and historical conventions may use alternative MIME identifiers for the same kind of file. Showing them all helps ensure compatibility across systems.