Skip to content

Eliom_content.Html.D.Unsafe.data only works in server side code #835

@OnkV

Description

@OnkV

Disclaimer: I'm not sure this is a bug, I'm possibly just "holding it wrong".

My System:

  • Debian 12
  • OCaml 5.2.1
  • Ocsigenserver 6.0.0
  • Eliom 11.1.1
  • Js_of_ocaml 5.9.1

Given there is some (safe) HTML in a string (generated by qrc). Let's say the value is "<b>Test</b>".
I'd like to render the HTML as a part of a Tyxml created page like this:

let%shared test_handler get_params post_params =
  let elem = Eliom_content.Html.D.Unsafe.data "<b>Test</b>" in
  ...
  Lwt_result.return (html (...)  (body [...; elem; ...])

This works as expected on the server side: the HTML code added to the DOM as an element, Test is rendered as bold text.

But on the client side, <b>Test</b> is inserted as literal text.

Shouldn't the behaviour be identical on both sides? Or is Eliom_content.Html.D.Unsafe.data the wrong tool to accomplish this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions