Kodiff · embedding
Send two versions of anything into Kodiff from your own page — and choose which fields get compared. Your text is never uploaded: it travels in the URL fragment or directly between browser tabs, and Kodiff has no server to send it to.
<script src="https://kodiff.com/embed.js"></script>
Pick based on how big the code is. Both keep the text out of every HTTP request.
KodiffEmbed.link()Builds a URL whose payload lives after the #. Browsers never send the fragment to a
server, and Kodiff sets Referrer-Policy: no-referrer, so it can't leak that way either.
Good for anchors and buttons; the payload is deflated, but keep it under roughly 64KB compressed —
mail clients and chat apps truncate long URLs.
const url = await KodiffEmbed.link({
a: oldXml,
b: newXml,
opts: {
title: "INC0010042 — before/after",
lang: "xml",
cleanNames: "sys_id, sys_mod_count, sys_updated_on",
cleanMode: "ignore" // hide those fields
}
});
link.href = url;
KodiffEmbed.open()Opens Kodiff and passes the payload straight between tabs in memory. No URL length limit, so this is the one for large blocks of code. Must run from a click, or the popup blocker stops it.
btn.addEventListener("click", () => {
KodiffEmbed.open({
a: leftText,
b: rightText,
opts: {
title: "catalog_item v1 → v2",
lang: "xml",
cleanNames: ["short_description", "state", "priority"],
cleanMode: "only" // compare ONLY these fields
}
}).catch(console.warn);
});
cleanMode: "ignore" hides the fields you name.
cleanMode: "only" inverts it — everything else disappears and Kodiff compares
only what you listed. For XML and HTML the names are element names, and hiding a parent hides
its contents.| Key | Meaning |
|---|---|
| a, b | The two sides, as strings. Required. |
| opts.title | Name shown in Kodiff's title bar. |
| opts.lang | xml, json, javascript, html… omit to auto-detect. |
| opts.cleanNames | Comma-separated string, or an array of names. |
| opts.cleanMode | ignore hides them · only compares just them. |
| opts.wsMode | all ignores whitespace differences. |
| opts.ignoreCase | Boolean. |
| opts.ignoreBlank | Boolean — ignore blank lines. |
| opts.view | live (side by side) or inline. |
Kodiff only accepts a handoff from the window that opened it, and only carrying a nonce that Kodiff itself generated. It never evaluates anything you send, whitelists every option key, and shows the origin the comparison came from in its status bar.