← All 93 demos

Relative and Absolute URLs

Compare relative and absolute URLs using the same starting content.

How it works

Use this example to compare how RichTextEditor handles relative and absolute URLs when content is inserted, saved, or rendered. Both editors start from identical markup; only urlType differs.

urlType: "relative"

Saved HTML

Loading…

urlType: "absolute"

Saved HTML

Loading…

Example code

<div id="div_editor1"> ... </div>

<script>
    // "relative" keeps /docs/quick-start as written.
    // "absolute" rewrites it to https://your-host/docs/quick-start on save.
    var cfg = {};
    cfg.urlType = "relative";   // or "absolute"
    var editor1 = new RichTextEditor("#div_editor1", cfg);
</script>

Choose relative when content is served from the same origin that authored it, and absolute when the HTML will be emailed, syndicated, or rendered on another host.

Configuration reference