For developers
Send downloads to Download Manager Plus from any website, with a link or with JavaScript.
Universal link
Link to /add with the file's address. If the user has the extension, they're asked to confirm the download; if not, they can install it or download the file directly.
<a href="https://download.extension.lat/add?name=manual.pdf&url=https%3A%2F%2Fexample.com%2Ffiles%2Fmanual.pdf" rel="nofollow">
Download with Download Manager Plus
</a>| Name | Description |
|---|---|
| url | The file's http(s) address. Required. |
| name | Suggested file name. Optional; it's sanitized before saving. |
“Add to Download Manager Plus” button
A link styled as a button. It works without JavaScript; with the helper script, it uses the bridge when it's available.
Preview
Add to Download Manager Plus<a
class="dmplus-button"
href="https://download.extension.lat/add?name=manual.pdf&url=https%3A%2F%2Fexample.com%2Ffiles%2Fmanual.pdf"
data-dmplus-url="https://example.com/files/manual.pdf"
data-dmplus-name="manual.pdf"
rel="nofollow"
>
Add to Download Manager Plus
</a>
<style>
.dmplus-button {
display: inline-flex;
align-items: center;
gap: 0.5rem;
padding: 0.625rem 1.25rem;
border-radius: 999px;
background: #a3e635;
color: #1a2e05;
font: 600 0.875rem/1 system-ui, sans-serif;
text-decoration: none;
}
.dmplus-button:focus-visible {
outline: 2px solid #1a2e05;
outline-offset: 2px;
}
</style>Helper script
A small, dependency-free script that exposes window.DownloadManagerPlus. The TypeScript types are in dmplus.d.ts.
<script src="https://download.extension.lat/sdk/dmplus.js" defer></script>
<!-- Optional: links with data-dmplus-url use the bridge. -->
<script src="https://download.extension.lat/sdk/dmplus.js" data-dmplus-auto defer></script>Add data-dmplus-auto to the script tag so links with data-dmplus-url use the bridge. Don't do this on pages that show links written by your users: on a trusted site, the bridge downloads without asking.
// Uses the bridge if it's available on your site; otherwise, opens the universal link.
const result = await window.DownloadManagerPlus.addDownload({
url: "https://example.com/files/manual.pdf",
name: "manual.pdf",
});
if ("requestId" in result) {
const state = await window.DownloadManagerPlus.bridge.status(result.requestId);
console.log(state.status); // "pending", "downloading", "complete"…
}JavaScript bridge
If the user lets websites send them downloads (the welcome guide offers this for every site) or allows your site from the extension icon, your page can request downloads and check their status with window.postMessage. The user still confirms each download, unless they mark your site (https) as trusted.
| Name | Description |
|---|---|
| dmplus:add | Requests a download: url, plus optional fileName and folder. |
| dmplus:status | Checks the status of a download your own page requested. |
| dmplus:result | The extension's reply, with the same id you sent. |
| dmplus:ready | The extension announces that the bridge is active on the page. |
| dmplus:ping | Asks whether the bridge is active; the extension replies with dmplus:ready. |
// Without the helper script: the same protocol with postMessage.
window.addEventListener("message", (event) => {
if (event.source !== window) return;
if (event.data?.source === "dmplus-extension" && event.data.type === "dmplus:result") {
console.log(event.data.id, event.data.result);
}
});
window.postMessage(
{
id: crypto.randomUUID(),
request: { url: "https://example.com/files/manual.pdf", fileName: "manual.pdf", v: 1 },
source: "dmplus",
type: "dmplus:add",
},
location.origin
);Reference
Statuses
| Name | Description |
|---|---|
| pending | Waiting for the user to confirm the download. |
| rejected | The user declined it or closed the window. |
| downloading | Downloading. |
| complete | Download finished. |
| failed | The download couldn't be completed. |
Error codes
| Name | Description |
|---|---|
| invalid-request | Malformed message, an address that isn't http(s) or a local network address. |
| unsupported-version | Your page uses a newer protocol version than the extension. |
| rate-limited | More than 10 requests per minute from your site. |
| too-many-pending | Requests are already waiting for confirmation. |
| not-found | That ID doesn't exist or wasn't requested by your page. |
| internal | Internal error; try again. |
Limits and privacy
Only http(s) addresses are accepted, with no custom headers or cookies. Each site can make up to 10 requests per minute and only receives the status of the downloads it requested. A public site can't request files from the user's local network.